使用 PreSignedUrl 直接上传到 S3 时,FineUploader onProgress 未正确触发

FineUploader onProgress not firing correctly when uploading directly to S3 using a PreSignedUrl

使用qq.s3.FineUploaderBasic从客户端直接上传文件到PreSignedUrl。

文件已上传到 S3,但进度事件未正确触发 - 在上传开始时触发一次或两次,当最后一个事件表明上传已完成但没有完成时,在网络选项卡上您可以看到文件仍在上传。
即使在 2MB 的文件中也很明显。

这是对 2140K 文件使用 debug:true 时的控制台

    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
区别在于演示不使用签名 url
比较 requests/responses 并没有发现任何不同之处

这是使用 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 问题..)

编辑 在 localhost 上工作时遇到这个问题,将其上传到我的暂存环境并且进度条完美运行,我认为 chrome 和 FireFox 在原点为 localhost

时报告错误进度

这里没有问题。该文件可能正在快速上传。由于您上传的文件非常小,因此情况更加复杂。上传结束时的等待是 S3 组合任何文件块,或者我们只是在等待对发送最后一个字节后设置发生的任何请求的响应。