简体   繁体   中英

blueimp file upload server side progress with PHP

I'm using the blueimp jquery file uploader in conjunction with Amazon S3. The only issue I have is that I'm unable to accurately update my progress bar based on the server side status of the image upload.

I'm also using an older version of PHP (5.3), is there a solution or a workaround that I can use to retrieve the server side progress?

Here is the jquery I'm currently calling:

    var url = 'photos/index.php';

    $('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        done: function (e, data) {

            $.each(data.result.files, function (index, file) {
               // display the image preview
            });
        },
        progressall: function (e, data) {

            //console.log(data);
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#progress .bar').css(
                'width',
                progress + '%'
            );
        }
    });

if your uploading directly your file directly to S3 Bucket through your PHP code, then it is impossible to show upload progress. Amazon S3 currently have no support for this. If you want to show any upload progress, show the upload progress of your server. After that move the uploaded file from your server to S3 Bucket. But in this way, the progress bar will take some time to complete on 98%-100%, because during that time only uploaded file will be moved to S3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM