Fine Uploader — Upload failed

让人想犯罪 __ 提交于 2019-12-13 12:46:32

问题


I would like to upload a file using Fine Uploader. I used the example given at the website:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Fine Uploader Demo</title>
    <link href="fineuploader-3.5.0.css" rel="stylesheet">
  </head>
  <body>
    <div id="fine-uploader"></div>
    <script src="fineuploader-3.5.0.js"></script>
    <script>
       function createUploader() {
          var uploader = new qq.FineUploader({
             element: document.getElementById('fine-uploader'),
             request: {endpoint: 'test.php'}
          });
       }
       window.onload = createUploader;
    </script>
  </body>
</html>

Apparently the upload process was fine. However, when the uploading finished, I got the "Upload failed" message.

I think we need another server-side script to handle the upload. How can the server-side script 'test.php' accept the upload? Any sample code provided will be appreciated.

Also, for Fine Uploader, is there an upper limit to the size of the file being uploaded? I tried uploading a 5GB file and it didn't seem to work.

Lastly, how can we display the rate of upload as well as the time remaining?


回答1:


@Deonia is right, and I would like to add a comment, but apparently don't have enough reputation...


There is a fairly comprehensive PHP example on the server-side repository.

You'll notice that the handleUpload function returns an associative array. This is the response from the server that indicates success. Check out the docs on server-side responses for ideas on what's valid.

In essence, anything other than a { success: true } response will result in Fine Uploader thinking the upload failed.




回答2:


You have asked so many questions

Firstly ,you need to use jquery for progress bar you want to show. A very nice tutorial to make such is here . So I am not writing code here .

The upload of file bigger than 5GB is handeled by your script allowance and its server timeout time. You need to check and allow the file upload timeout more than 1 hour depends on you .

NEW update

As you asked the question the below is the answer

request: {
            // path to server-side upload script
        endpoint: 'test.php'
         }

Also in your test.php file uncomment:

 // max file size in bytes (Below I have made 10GB)

    $sizeLimit = 10 * 1024 * 1024 * 1024;


来源:https://stackoverflow.com/questions/16828631/fine-uploader-upload-failed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!