我使用blobstore google app引擎编写了以下代码来上传文件。我得到了Uncaught TypeError,如何克服它。一切正常,但这个例外仍然存在。我尝试添加processData: false
,但blobstore代码不接收来自javascript的上传数据。
$('#insert-sub').click(function (){
$('#insert-form').validate({
rules:
{
issueName:
{
minlength: 2,
required: true
},
issueFilename:
{
required: true,
extension: "pdf",
}
},
submitHandler: function(form){
var currentDate = new Date();
var day = currentDate.getDate();
var month = currentDate.getMonth() + 1;
var year = currentDate.getFullYear();
var issueDate = day + "/" + month + "/" + year;
$('#issueDate').val(issueDate);
$('#insertForm').hide();
filename = $('#issueFile').val();
var fData = new FormData();
if(filename.substr(-3) == "pdf")
{
$.ajax({
url: upload_url,
type: "POST",
processData: false,
data: fData,
});
}
else
{
alert("Invalid File Extension, upload .pdf")
}
}
});
});
});`