Redirecting before POST upload has been completed
- by vartec
I have form with file upload. The files to be uploaded actually are pictures and videos, so they can be quite big. I have logic which based on headers and first 1KB can determine if the rest will be processed or immediately rejected. In the later case I'd like to redirect client to error page without having to wait for upload to finish.
The case is, that just sending response before POST is complete doesn't seem to work. The redirect get's ignored and if I close connection, browser complains with "Connection reset by peer" error.
So the question is: is it even possible to do that in pure HTTP (without JavaScript on client-side), and if so, how?