Blueimp FileUpload:返回responseText时出现fileuploadsubmit错误
我正在使用Blueimp FileUpload插件,当我尝试在上传图像后捕获响应时,一切都很好:
var fi = $('#fileupload'); //file input var process_url = '/backoffice/listings/upload-images '; var progressBar = $('').addClass('progress').append($('').addClass('progress-bar')); //progress bar var uploadButton = $('').addClass('button btn-blue upload').text('Upload'); //upload button uploadButton.on('click', function () { var $this = $(this), data = $this.data(); data.submit().always(function () { $this.parent().find('.progress').show(); $this.parent().find('.remove').remove(); $this.remove(); }); }); fi.fileupload({ url: process_url, dataType: 'json', autoUpload: false, acceptFileTypes: /(\.|\/)(gif|jpe?g|png|mp4|mp3)$/i, maxFileSize: 1048576, //1MB disableImageResize: /Android(?!.*Chrome)|Opera/ .test(window.navigator.userAgent), previewMaxWidth: 50, previewMaxHeight: 50, previewCrop: true, dropZone: $('#dropzone') }); //other functions work fine //Code which needs to comes after submit fi.on('fileuploadsubmit', function (e, data) { console.log('submit'); console.log(data); }); });
在开发者控制台中快速浏览一下,确实有一个响应文本:
但是当我试图获取响应时: console.log(data.jqXHR.responseText);
,我得到一个Uncaught TypeError: Cannot read property 'responseText' of undefined
错误的Uncaught TypeError: Cannot read property 'responseText' of undefined
。
哪里可能出错?
- 不调用Symfony 3.1和OneUpUploaderBundle + Blueimp = UploadListener
- 我应该返回什么来响应blueimp / jquery.file-upload-ui的删除事件上的show error消息
- jQuery文件上传不提交额外参数
- blueImp / jquery文件上传 – 如果不接受文件类型,如何收到错误消息?
- blueimp jQuery-File-Upload没有ajax
- jQuery文件上传(Blue imp)Symfony 2 405方法不允许
- 完成多个文件上传
- blueimp jquery-file-upload如何在上传前取消1个文件
- 使用Jquery blueimp将图像上传到App Engine: