5

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 + '%'
            );
        }
    });
Paul
  • 11,671
  • 32
  • 91
  • 143
  • Have you tried it with one of the samples on https://github.com/blueimp/jQuery-File-Upload/wiki? You might wanna provide some of your php code, too. – Louis Huppenbauer Feb 06 '14 at 16:17

1 Answers1

1

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.

sincerekamal
  • 127
  • 1
  • 2
  • 10
  • Not impossible, you can show upload progress in modern browsers using Ajax: http://www.dave-bond.com/blog/2010/01/JQuery-ajax-progress-HMTL5/ – Petah Mar 01 '14 at 09:59
  • Petah, I agree you can show upload progress, but progress to your server only. You can't show the S3 file upload progress without flash or java because of CORS policy. http://stackoverflow.com/questions/6543292/how-to-upload-files-directly-to-s3-using-php-and-with-progress-bar/#answer-7176472 – sincerekamal Mar 01 '14 at 10:07