flowjs / ng-flow

Flow.js html5 file upload extension on angular.js framework
http://flowjs.github.io/ng-flow/
MIT License
1.38k stars 303 forks source link

ASPNET WebAPI 2 server: no upload on 404 #160

Open Myrmex opened 9 years ago

Myrmex commented 9 years ago

Hello, I'm trying to use this library with an ASP.NET WebAPI 2 server, but no upload ever starts when I select a file: the GET handler is called, and I return 404, but no more processing occurs. I tried returning 202 as the docs seems to suggest that 404 stops the upload process altogether, but nothing changes.

I provided a full repro solution and more information at this post: http://stackoverflow.com/questions/29694470/uploading-files-with-flow-js-ng-flow-to-webapi-2 . Given that it contains a code sample for ASP.NET WebAPI, it would be nice to fix it so that it could be a sample for using this library in this server environment, as googling around I could find only PHP.

Could anyone suggest how to fix? Am I really supposed to return 404 from the initial GET? Thanks!

n8stowell82 commented 9 years ago

My team was having this exact issue. After reading your post above I changed my response from "HttpStatusCode.NotFound" (404) to "HttpStatusCode.NoContent" (204). On initial testing it seems to work as intended with the added benefit of not littering the console with 404 messages.

robbaman commented 9 years ago

I had the same issue when upgrading from ng-flow 2.5 to 2.6, switching the result from 404 to 204 fixed it for me.

Myrmex commented 9 years ago

Thank you, I had forgotten to reply to this thread. You are right, please see the (updated) above SO post for the same answer.