尝试在fineUploader中解析XHR响应文本时出错

尝试在fineUploader中解析XHR响应文本时出错

问题描述:

我现在将这个精美的上载器版本3.3.0打包了,并将所有lib集成到我的网站中,我认为上传可以正常工作,但是没有!我的JavaScript控制台出现错误:

I bay this fine-uploader version 3.3.0 now, and integration all lib in my site i think uploads make working its ok, but no! i see error my javascript console:

[FineUploader] Sending upload request for 0

[FineUploader] xhr - server response received for 0

[FineUploader] responseText = 

和错误萤火虫:

[FineUploader]尝试解析xhr响应文本时出错(SyntaxError:JSON.parse:数据意外结束)

[FineUploader] Error when attempting to parse xhr response text (SyntaxError: JSON.parse: unexpected end of data)

在线错误:jquery.fineuploader-3.3.0.min.js(第148行)

at line error: jquery.fineuploader-3.3.0.min.js(line 148)

我使用参数:

$(document).ready(function () {
    $('#uploader').fineUploader({
    request: {
        endpoint: '/upload/'
      },
    classes: {
        success: 'alert alert-success',
        fail: 'alert alert-error'
         }, 
    text: {
        uploadButton: '<i class="icon-upload icon-white"></i> file target'
      },
       validation: {
      sizeLimit: 31457280 

      },             
    debug: true

    });
  });

如果我正在写sizeLimit:10485760-好的,可以工作了!文件上传完成.如果写入大小限制:31457280文件未上传到末尾,则进程中断为2%或3%.帮我!哪里有虫子?请帮助我!

if i am write sizeLimit: 10485760 - it all right ok working! file uploads to finish. If write sizelimit: 31457280 file not uploads to end, process break to 2 or 3%. Help me! where bug? Please help me somebody!

以下日志消息:

尝试解析xhr响应文本时出错(SyntaxError:JSON.parse:数据意外结束)

Error when attempting to parse xhr response text (SyntaxError: JSON.parse: unexpected end of data)

通常表示您的服务器未返回有效的JSON响应.这通常是由服务器端发生意外错误引起的.请注意,您必须始终从服务器返回有效的JSON响应.如果您使用的是IE9或更旧的版本,请确保还返回200的响应代码.

Generally indicates your server is not returning a valid JSON response. This is usually caused by an unexpected error server-side. Note that you must ALWAYS return a valid JSON response from your server. If you are using IE9 or older, be sure to return a response code of 200 as well.