8

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 = 

and error firebug:

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

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

i use params:

$(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

    });
  });

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!

4

3 回答 3

9

以下日志消息:

尝试解析 xhr 响应文本时出错(SyntaxError: JSON.parse: unexpected end of data)

通常表明您的服务器未返回有效的 JSON 响应。这通常是由服务器端的意外错误引起的。请注意,您必须始终从服务器返回有效的 JSON 响应。如果您使用的是 IE9 或更早版本,请务必同时返回响应代码 200。

于 2013-04-30T14:10:58.417 回答
2

我的脚本也遇到了同样的问题,该脚本可以在本地完美运行,但不能在服务器上运行。

我们需要确保的几点:

  1. 按照此处endpoint所述正确设置

  2. 确保脚本最初要上传文件的目录(在我的情况下是 example-advanced\uploads )是可写的。它应该有 777 权限。我在这里遇到了问题。

  3. max_file_upload_limit应相应设置。

可能还有更多。但这些是我迄今为止所面临的少数。希望这会对某人有所帮助。

于 2014-12-31T06:26:27.167 回答
0

对于coldfusion的人来说,这是解决我问题的代码

<cfoutput>

<cffile
action       = "upload"
fileField    = "QQFILE"
destination  = "#application.OSSandbox#"
accept       = "image/jpeg"
nameConflict = "MakeUnique"
result="imgUploadResult"
/>
<cfset json = CreateObject("component", "#application.CFCRoot#.json2")> // custom code to create a json object
<cfset dataset = json.encode(imgUploadResult,"array")>
<cfset dataset = REReplace(dataset,'("recordcount")','"success": true, \1')>

<cfcontent type="text/plain; charset=ISO-8859-1"><cfoutput>#dataset#</cfoutput>
</cfoutput>
于 2019-06-03T10:24:55.227 回答