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

Flash FileAPI HTTP error code 400 is treated as success #92

Closed
gessnerfl opened this issue Jan 3, 2014 · 9 comments
Closed

Flash FileAPI HTTP error code 400 is treated as success #92

gessnerfl opened this issue Jan 3, 2014 · 9 comments

Comments

@gessnerfl
Copy link

Hi,

I need the flash-based FileApi solution for IE8 support. Thereby I face the following issue:
I try to bind event handler for all three events (success, error, progress). In the HTML5 version without FileApi everything works fine. But with the FileAPI the success handler is called in case of an error but in case of an successful upload no handler is called.

This issue happens when using success( ), error( ), and progress( ) and also when just using then( ) to bind the event handler functions.

I am using the latest version 1.2.3.

Thanks and Best Regards
Florian

@danialfarid
Copy link
Owner

What version of angularjs?

@gessnerfl
Copy link
Author

I am using angular 1.0.3.

@danialfarid
Copy link
Owner

you mean 1.2.3?
Only angular 1.0.7+ is supported by this plugin.

@gessnerfl
Copy link
Author

I updated to the latest version of angular (1.2.6) but I still face exactly the same issue

@danialfarid
Copy link
Owner

Try the demo page. It uses the then() function and it does receive the success result to show on the page.
See if he demo page works on your IE8.

@gessnerfl
Copy link
Author

The demo page works fine but it is not really representative in this case because there is not error handler in place.
I made some detailed analysis and figured out what is going wrong:

  • My implementation did not return any data when upload was successful but just confirmed the upload with HTTP Code 200.
  • I added some dummy data and after this the handler is being triggered.

HOWEVER

  • When an error occurs the backend response with HTTP Code 400 and additional details in the data segment
  • In IE also the success handler will be triggered and status code is not 400 but 200.
  • If I would not return any data in the 400 response no error handler will be triggered at all.

I used fiddler2 to get the original HTTP traffic and used the IE8 developer tools for debugging.

Are there any limitations in respect to the File API?

@danialfarid
Copy link
Owner

Seems like a bug with Flash or FileAPI.
If server returns an error code > 400 it would work but only 400 will be considered as 200 success in FileAPI.
So the workaround would be to return any other error code like 403, 500 and you would be able to get error callback.
Thanks for investigating this. I have already asked the question in the FileAPI issue tracker I will update you if I know more about this issue.

@danialfarid
Copy link
Owner

@danialfarid danialfarid changed the title Upload via FileAPI and Event binding Flash FileAPI HTTP error code 400 is treated as success Jul 21, 2014
@danialfarid
Copy link
Owner

Doesn't seem to be that serious issue since there are workarounds and not an easy solution since it is a flash FileAPI related issue. Marking it as won't fix for now.

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

2 participants