我尝试上传.doc,.docx文件,但它一直在我的控制台中发送错误。这是我的剧本:
var formData = new FormData(document.forms['myRptForm']);
$.ajax({
url: myUrl,
type: 'POST',
data: formData,
async: false,
success: function (res) {
str = res.split("|");
if(str[0]==0){
alert('Sorry Files are not successfully Uploaded!');
}else if(str[0]==1){
alert('File are successfully Uploaded!');
$('#userfile').val('').show();
}else if(str[0]==2){
alert(str[1]); $('#userfile').val('').show(); return false;
}
$('#myData').html(str[1]).show();
},
cache: false,
contentType: false,
processData: false,
//error: function(err){
//alert(err.status);
//}
});
这是main-function.php: