Fine Uploader S3,大文件,ERR_NAME_NOT_RESOLVED

时间:2016-01-31 07:46:42

标签: fine-uploader

我使用Fine Uploader直接上传到S3。它适用于小文件,但任何大的文件,如6GB,都会导致javascript控制台出现以下错误: screen shot of javascript Err_name_not_resolved

我在这里上传名为" 6gb"的文件。

这是服务器日志(Ruby on Rails)。第一次请求签名时,上传第1部分:

Started POST "/signature" for 192.168.188.129 at 2016-01-31 00:51:12 +0000
Processing by UploadsController#signature as JSON
  Parameters: {"headers"=>"PUT\n\n\n\nx-amz-date:Sun, 31 Jan 2016 00:51:14 GMT\n/bv-deliverables/uploadsFolder/7c54325c-1db6-4d66-a31f-ceecb3c4ee2a.6gb?partNumber=1&uploadId=AD7mVbSzuhyC9JhgmZVu7dGEr5mJuEh8EpZTmx4Tl5M6r3ki6YDJvBqLfkDzFLQJGBpKGpzbwC8uPo7h3JGwQA--", "upload"=>{}}
Completed 200 OK in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms)

对每个部分重复此POST to / signature,直到部分#133,其中加载了retry.gif,并且出现了javascript控制台中的错误。

Started POST "/signature" for 192.168.188.129 at 2016-01-31 01:34:36 +0000
Processing by UploadsController#signature as JSON
  Parameters: {"headers"=>"PUT\n\n\n\nx-amz-date:Sun, 31 Jan 2016 01:34:37 GMT\n/bv-deliverables/uploadsFolder/7c54325c-1db6-4d66-a31f-ceecb3c4ee2a.6gb?partNumber=133&uploadId=AD7mVbSzuhyC9JhgmZVu7dGEr5mJuEh8EpZTmx4Tl5M6r3ki6YDJvBqLfkDzFLQJGBpKGpzbwC8uPo7h3JGwQA--", "upload"=>{}}
Completed 200 OK in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms)


Started GET "/assets/retry.gif" for 192.168.188.129 at 2016-01-31 01:35:16 +0000

我相信我正确地签署了标题,因为它似乎可以解决这个问题。

我的上传速度约为每秒2兆位。

这是我的AWS CORS:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>DELETE</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <ExposeHeader>ETag</ExposeHeader>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

这是我的Fine uploader javascript:

    $('#fine-uploader-s3').fineUploaderS3({
        template: 'qq-template-s3',
        request: {
            endpoint: "https://s3.amazonaws.com/bv-deliverables",
            accessKey: "AKIAILA4KWEGIGGBAL5Q"
        },
        signature: {
            endpoint: "signature",
            customHeaders: {"X-CSRF-Token":"<%= form_authenticity_token %>"}
        },
        uploadSuccess: {
            endpoint: "create",
            customHeaders: {"X-CSRF-Token":"<%= form_authenticity_token %>"},
            params: {
                isBrowserPreviewCapable: qq.supportedFeatures.imagePreviews
            }
        },
        iframeSupport: {
            localBlankPagePath: "/server/success.html"
        },
        cors: {
            expected: true
        },
        chunking: {
            enabled: true
        },
        resume: {
            enabled: true
        },
        deleteFile: {
            enabled: false
        },
        validation: {
            itemLimit: 5,
            sizeLimit: 107374182400
        },
        objectProperties: {
            reducedRedundancy: true,
            key: function (fileId) {

                var filename = $('#fine-uploader-s3').fineUploader('getName', fileId);
                var uuid = $('#fine-uploader-s3').fineUploader('getUuid', fileId);
                console.log(fileId);
                var ext = filename.substr(filename.lastIndexOf('.') + 1);

               return  'uploadsFolder/' + uuid + '.' + ext;
            }
        },
        callbacks: {
            onComplete: function(id, name, response) {
                var previewLink = qq(this.getItemByFileId(id)).getByClass('preview-link')[0];
                location.reload();
                if (response.success) {

                    previewLink.setAttribute("href", response.tempLink)
                }
            }
        }
    });

重新添加失败的文件似乎会在失败的位置恢复上传。

同样,它适用于小文件(如15KB)和较小的多部分文件(如10MB),但是当我尝试上传大型6GB文件时会出现错误。

1 个答案:

答案 0 :(得分:0)

这显然是一个网络问题,超出了Fine Uploader的控制范围。如果启用auto retry feature,则应尝试自动恢复。如果失败,您可以使用retry API method手动重试上传,或使用Fine Uploader UI启用的重试按钮。