-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only post data can not get the progress well #279
Comments
You are supposed to set your file as |
Thanks danialfarid's reply~ but... i try the #88 ‘s sample in my project like this var fileReader = new FileReader();
fileReader.onload = function(e){
$upload.http({
url: 'xxx',
headers: {'Content-Type': oFile.type},
data: e.target.result
}).progress(function(evt) {
console.log(evt.loaded);
console.log(evt.total);
})
};
fileReader.readAsArrayBuffer(_b64toBlob(oFile.base64.split(',')[1], oFile.type)); i convert the base64 to a blob and upload it(with a low network speed).
i used chrome lastest. and the scripts tag is so
what's wrong with me ~~ |
It might be that your server does not support progress response. If you see the demo page and select the second option for how to upload, it will actually use |
I try the simple demo like the readme, just upload a file, we used nginx at the frontend, and unicorn at the backend. I think that the progress event is also depended on the server configuration. |
Happens the same here, a workaround is to set the method to PUT, in that way the progress callback is executed for me. I use a node.js with express 4.0 backend API. |
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(){
}) |
For amazon S3 upload the demo page now has the option for S3 upload and the progress bar is working. You can try it out and if it works on your S3 bucket then compare your code with the demo see which parts you are doing differently. |
Hello. I'm experiencing this same issue. I'll drop some additional code in below, but as a general question, if I'm uploading data to an internal file service API created in .NET by one of my colleagues, is there something he needs to do on his end to support me getting these events? More specifically, here's the code I have, with some app-specific particulars removed. First, the scope function containing the call to $upload.upload: $scope.upload = $upload.upload({ In this case, baseUrl contains the full API end-point I'm posting to, 'Content-Type' is set to what my colleague told me to set it to (which works, sans progress updates), and the file object passed to me in a drag/drop event. Next, my scope function that handles the promise: $scope.upload.then(function(data) {
}, function(response) { Of course, I'm hoping the function(evt) will occasionally give me an update, but never once have I received one. Any assistance with this is appreciated. |
Yes there might be special configuration on the server needed to enable progress event. |
hi,danialfarid
Your uploader is quite cool.
But when i use it to post a big data without any file or form data like this.
the console shows that the evt.total is a right size.
but the evt.loaded also reached as big as the evt.total at the same time,no matter how slow i set my upload network speed.
so i can not get the right progress.
how to make it work well?
The text was updated successfully, but these errors were encountered: