2016-07-18 39 views
0

使用qq.s3.FineUploaderBasic将文件从客户端直接上传到PreSignedUrl。当使用PreSignedUrl直接上传到S3时,FineUploader onProgress无法正确触发

文件上传到S3,但进度事件未正确触发 - 在上传开始时触发一次或两次,当最后一个事件指出上传已完成但未完成时,网络标签,你可以看到该文件仍在上传。
即使在2MB文件中也是显着的。

这里是使用调试时控制台:

Received 1 files. 
    Attempting to validate image. 
    Attempting to draw client-side image preview. 
    Attempting to determine if test.pdf can be rendered in this browser 
    First pass: check type attribute of blob object. 
    test.pdf is not previewable in this browser per the blob's type attr 
    Not previewable 
    Sending simple upload request for 0 
    Submitting S3 signature request for 0 
    Sending POST request for 0 
    Sending upload request for 0 
    // here the upload started, put console.log at the onProgress event to log loaded, total 
    // 901120 2191263 
    // 2191263 2191263 
    // NOTE - seems like the file finishd upload but it takes it some time to finish uploading** 
    s3.fine-uploader-5.10.0.js?v=2.0.3.1:252 [Fine Uploader 5.10.0] Received response status 200 with body: 
    s3.fine-uploader-5.10.0.js?v=2.0.3.1:252 [Fine Uploader 5.10.0] Simple upload request succeeded for 0 
    s3.fine-uploader-5.10.0.js?v=2.0.3.1:252 [Fine Uploader 5.10.0] Submitting upload success request/notification for 0 
    s3.fine-uploader-5.10.0.js?v=2.0.3.1:252 [Fine Uploader 5.10.0] Sending POST request for 0 
    s3.fine-uploader-5.10.0.js?v=2.0.3.1:252 [Fine Uploader 5.10.0] Received the following response body to an upload success request for id 0: {..} 
    s3.fine-uploader-5.10.0.js?v=2.0.3.1:252 [Fine Uploader 5.10.0] Upload success was acknowledged by the server. 

进度正常工作在fineUploader demo page
不同的是,演示没有使用已签署的网址
比较请求真正为2140K文件/回应,并没有发现任何不同

以下是使用qq.FineUploaderBasic上传到我的服务器时的同一个文件的日志:

Received 1 files. 
    Attempting to validate image. 
    Attempting to draw client-side image preview. 
    Attempting to determine if test.pdf can be rendered in this browser 
    First pass: check type attribute of blob object. 
    test.pdf is not previewable in this browser per the blob's type attr 
    Not previewable 
    Sending simple upload request for 0 
    // 311296 2191263 
    // 1032192 2191263 
    // 1064960 2191263 
    // 1081344 2191263 
    // 1130496 2191263 
    // 1245184 2191263 
    // 1507328 2191263 
    // 1622016 2191263 
    // 1949696 2191263 
    // 2191263 2191263 
    // Here the progress finished when the file actually got to my server 
    xhr - server response received for 0 
    responseText = {..} 
    Received response status 200 with body: {..} 
    Simple upload request succeeded for 0 

会为任何方向感到高兴如何解决这个问题,已经把console.log放在进度事件点的fineUploader代码中,看到它没有吞咽进度事件,好像我错过了一些东西(可能是CORS问题..)

编辑 在本地主机上工作时,有这个问题,它上传到我的分期env和进度条完美的作品,我认为Chrome和Firefox报告故障的进展时原点为localhost

回答

0

这里没有问题。该文件可能只是非常快速上传。这是因为你正在上传非常小的文件。上传结束时的等待时间是S3或者组合任何文件块,或者我们只是等待最后一个字节发送后发生的任何请求的响应。

+0

在演示页面上传了相同的文件,并且进度条移动到了它应该的位置,并且在请求完成时(在网络标签处观看它) 在我的场景中进度条移动速度非常快,达到100%(100%我希望我有一个快速上传),它只是激发所有的进度事件,然后继续上传 –

+0

已经调试了这几天.. –

+0

刚刚上传了一个11MB的文件,并得到了相同的结果 - 进度事件一开始火力达到100%,然后等待它完成很长时间 –