Skip to content
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

IE9 error response undefined #182

Closed
albitxu opened this issue Apr 4, 2014 · 9 comments
Closed

IE9 error response undefined #182

albitxu opened this issue Apr 4, 2014 · 9 comments

Comments

@albitxu
Copy link

albitxu commented Apr 4, 2014

When uploading a file using IE9 the response received in the error event is always undefined. I can't get the error message received from the server.

$scope.uploadTemplate = function() {
                $upload.upload({
                    url: '/data/kpi/upload?session_id=' + $scope.getSessionID(),
                    file: $scope.files[0],
                    paramName: 'file'
                }).success(function(response) {

                    }
                }).error(function(response, status) {
                    console.log('response=' + response);
                   //This is always undefined
                });
            };

In other browser it works perfectly. When the upload is successful everything goes fine. FileAPI is loading fine and also shim js. Why is the response always undefined? Am I doing something wrong?

Can you help, please?

@danialfarid
Copy link
Owner

Can you use the non-minified version version of the files and put a breakpoint here : https://github.com/danialfarid/angular-file-upload/blob/master/dist/angular-file-upload-shim.js#L92
Then when the error happens see if there is any information about the error in err or fileApiXHR objects?

@albitxu
Copy link
Author

albitxu commented Apr 4, 2014

Thanks for the quick answer. I can't debug the code in IE9 because FileAPI always gives an error "no space in stack". I have activated FileAPI debug mode and include some console.log in file-upload-shim.js in the line you mentioned. FileAPI seems to detect an error, but the response from server is not included neither in err neither in xhr variables:

(flash -> js).log: fileReference.upload HTTPStatusEvent: 500 
 (flash -> js).log: fileReference.upload onError: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2038"] 
 FlashAPI.upload.error 
 xhr.end: 500 IOError [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2038 
 err=IOError [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2038 
 xhr={"__requestHeaders":[],"upload":{},"__listeners":[],"__url":"/OIS/rest/data/kpi/upload?session_id=bcd15ab8-ee6e-43a7-8835-eb322d05a3ae","__fileApiXHR":{"uid":"fileapi13966308469146","xhr":{},"options":{"jsonp":"callback","imageOriginal":true,"chunkSize":0,"chunkUploadRetry":0,"uploadRetry":0,"url":"/OIS/rest/data/kpi/upload?session_id=bcd15ab8-ee6e-43a7-8835-eb322d05a3ae","headers":[],"data":{},"files":{"file":{"flashId":"fileapi13966308469142","type":"pdf","id":"1396630851554731","name":"10_ComoAsegurarEntregaEmailing.pdf","size":11387830}}},"files":[{"flashId":"fileapi13966308469142","type":"pdf","id":"1396630851554731","name":"10_ComoAsegurarEntregaEmailing.pdf","size":11387830}],"total":11387830,"loaded":11387830,"filesLeft":0,"currentFile":{"flashId":"fileapi13966308469142","type":"pdf","id":"1396630851554731","name":"10_ComoAsegurarEntregaEmailing.pdf","size":11387830},"status":"500","statusText":"IOError [IOErrorEvent type=\"ioError\" bubbles=false cancelable=false eventPhase=2 text=\"Error #: [IOErrorEvent type=\"ioError\" bubbles=false cancelable=false eventPhase=2 text=\"Error #2038"},"__total":11387830,"__loaded":11387830} 
 response=undefined 

@danialfarid
Copy link
Owner

You need to use the exact same version of FileAPI that is provided
Error #2038 is a flash error. At least you get the status code 500.
I believe it is a limitation of Flash and you probably won't be able to get the error message in the body. You can open an issue on FileAPI github, https://github.com/mailru/FileAPI/ but most probably that's Flash limitation.

One workaround would be to return different http error codes on the server for different errors and depending on the error status code show messages on the front-end.

@albitxu
Copy link
Author

albitxu commented Apr 7, 2014

Hi Danial,

I'm using exactly the FileAPI version downloaded with angular-file-upload
when using bower. Therefore, it is the version you have within your
package. I guess it should be the correct one.

Of course I will try returning different http error codes, but it is a
dirty solution...

Thanks anyway for all your quick help!!

2014-04-04 20:57 GMT+02:00 Danial Farid notifications@github.com:

You need to use the exact same version of FileAPI that is provided
Error #2038 is a flash error. At least you get the status code 500.
I believe it is a limitation of Flash and you probably won't be able to
get the error message in the body. You can open an issue on FileAPI github,
https://github.com/mailru/FileAPI/ but most probably that's Flash
limitation.

One workaround would be to return different http error codes on the server
for different errors and depending on the error status code show messages
on the front-end.

Reply to this email directly or view it on GitHubhttps://github.com//issues/182#issuecomment-39599086
.

@shiva2035
Copy link

Hi, I am using the below code for uploading. It's working fine in IE 10,11,Edge, Firefox, Chrome. But in IE9 it's showing response 'undefined'.

Upload.upload({
url: '/por/api/attachment',
file: file
}).progress(function (evt) {
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
file.uploadPct = progressPercentage;
console.log('In Progress');
}).success(function (data, status, headers, config) {
file.uploadPct = 100;
file.attachmentData = data.response;
console.log('In Success');
}).error(function(response, status) {
console.log('In Error');
console.log('response=' + response);
});
});

Can you help, please?

@danialfarid
Copy link
Owner

So success is called with undefined response? What does your server sends back?

@shiva2035
Copy link

shiva2035 commented Aug 30, 2015

Yes, success is called with Undefined response.
My server sends back with empty data. In other browsers it sends the data.

Thanks & Regards,
Shiva Kumar. K
http://in.linkedin.com/in/shiva2035
https://sites.google.com/site/shivab082035

On Fri, Aug 28, 2015 at 10:10 PM, Danial Farid notifications@github.com
wrote:

So success is called with undefined response? What does your server sends
back?


Reply to this email directly or view it on GitHub
#182 (comment)
.

@danialfarid
Copy link
Owner

well if your server response is empty then you would expect empty data on the client too.

@shiva2035
Copy link

shiva2035 commented Aug 30, 2015

Did it work for anyone on IE9? I don't think it's problem with my back-end
code, because I checked for the response in back-end code with the help of
breakpoints the server is having some response.

Thanks & Regards,
Shiva Kumar. K
http://in.linkedin.com/in/shiva2035
https://sites.google.com/site/shivab082035

On Sun, Aug 30, 2015 at 9:06 AM, Danial Farid notifications@github.com
wrote:

well if your server response is empty then you would expect empty data on
the client too.


Reply to this email directly or view it on GitHub
#182 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants