Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 + '%'
            );
        }
    });
like image 406
Paul Avatar asked Nov 13 '22 02:11

Paul


1 Answers

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.

like image 133
sincerekamal Avatar answered Nov 14 '22 21:11

sincerekamal