danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarify server requirements for upload progress (in README)

Sjors opened this issue · comments

This had me confused for a bit, but if I understand correctly not all servers return upload progress information. In particular a local development server like WEBrick doesn't. I believe Heroku doesn't either; if you need to see progress there, you'll have to upload directly to Amazon S3.

I don't think progress event depends on server. Do you have a web link or any document to support this?

I just noticed my progress callback never gets called when I try it with a WebRick server locally or when I try uploading something to Heroku. That was using Chrome on a Mac, with angular-file-upload-html5-shim loaded before AngularJS. Then I found articles like this one pointing to an Apache module that's required. But maybe I'm just doing something wrong.

Hey, I got the same issue here, the progress callback is never invoked. I am using a express backend.

I added more details to the readme file.

I am using express.js as backend, and progress block is not getting called. I am uploading file directly to amazon s3

 scope.upload = upload.upload({
                        url: 'https://' + s3Params.bucket + '.s3.amazonaws.com/',
                        method: 'POST',
                        data: {
                            'key' : 'uploads/'+ Math.round(Math.random()*10000) + '$$' + file.name,
                            'acl' : 'public-read',
                            'Content-Type' : file.type,
                            'AWSAccessKeyId': s3Params.AWSAccessKeyId,
                            'success_action_status' : '201',
                            'Policy' : s3Params.s3Policy,
                            'Signature' : s3Params.s3Signature
                        },
                        file: file,
                        headers: { "x-amz-server-side-encryption": 'AES256', 'Content-Type' : 'multipart/form-data'}
                    }).progress(function(evt){
                        console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total));
                        file.progress =  parseInt(100.0 * evt.loaded / evt.total);
                    }).success(function(){

})