使用SDK和Uploadify将文件上载到Amazon S3时显示的上载进度不正确

ame*_*exn 10 c# asp.net-mvc jquery amazon-s3 uploadify

我的ASP.NET MVC(C#)应用程序使用Uploadify使用SDK for .NET将文件上传到Amazon S3,但它显示错误的上载进度.

当我使用Uploadify将文件直接上传到我们的服务器时,它工作正常.但是,当我使用Amazon S3 TransferUtility.Upload方法上传文件时,进度条快速显示100%完成,但我需要等待很长时间才能获得Uploadify的onComplete事件.我的代码如下所示.

C#代码:

using (transferUtility = new TransferUtility(AWSAccessKey, AWSSecretKey))
{
    try
    {
        TransferUtilityUploadRequest request = new TransferUtilityUploadRequest();

        request.WithBucketName(AWSBucket)
            .WithKey(folderKey)
            .WithTimeout(5 * 60 * 1000)
            .WithInputStream(uploadFileStream);

        request.WithCannedACL(S3CannedACL.PublicRead);

        transferUtility.Upload(request);
    }                
    catch (AmazonS3Exception amazonS3Exception)
    {
        throw amazonS3Exception;
    }
}
Run Code Online (Sandbox Code Playgroud)

JavaScript代码:

jQuery(document).ready(function () {
    var allowdfileext='*.doc;*.docx;*.pdf;'
    var extarray=allowdfileext.split(';');

    jQuery('#proposalUploadFile').uploadify({
        'uploader': '/Content/uploadify/uploadify.swf',
        'script': '/File/Upload',
        'folder': '/uploads',
        'buttonImg':'/Content/uploadify/upload-file.jpg',
        'cancelImg': '/Content/uploadify/cancel.png',
        'auto': true,            
        'height': '25',
        'width': '95', 
        'wmode':'transparent',
        'sizeLimit': '20971520',
        'onComplete': fileUploaded,
        'multi': false,
        'scriptData': {
            'saveToFolder': 'Temp',
            'fileextension':'*.doc;*.docx;*.pdf;',
            'subdomain':'qa','saveInLocal':'True'
        },
        'fileExt':'*.doc;*.docx;*.pdf;',
        'fileDesc':'Files (*.doc;*.docx;*.pdf;)',
        'onAllComplete': fileUploadCompleted,
        'onError' : function(event, ID, fileObj, errorObj) {
            var r = '<br />ERROR: ';

            switch(errorObj.info) {
                case 405:
                    r += 'Invalid file type.';
                    break;
                case 406:
                    r += 'Some other error.';
                    break;
                default:
                    r += 'Some other error.';
                    break;
            }       
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

为什么进度条不像我期望的那样更新?

Hal*_*Hal 0

TransferUtility 如何从服务器端通信回 swf 客户端?我假设从客户端到服务器的上传将反映在进度栏中。接下来,服务器传输到 S3 的速度(比写入本地文件慢得多),不会向客户端 (swf) 报告。这将解释上传达到 100% 和必须等待页面响应之间的延迟。