Home: Perl Programming Help: mod_perl:
Getting Apache to stop a browser file upload

New User

May 17, 2010, 8:31 AM

Views: 24011
Getting Apache to stop a browser file upload

I'm trying to figure out a way to shield the server from oversized web form file uploads - a way that can stop the upload before all the data has been received.

With a mod_perl module I think I should be able to have a handler check the upload size from the headers and abort the process if the file exceeds a limit? I don't want to issue a 403 when that happens. Instead I'd just like to end the request/response connection and quietly issue a '200 OK' (Perhaps I'll use some Javascript to display an error message on the page).

But who is the boss in a form file upload connection? Apache or the browser? In other words, is there ANY way server-side to stop the browser in its tracks in the middle of a file upload? Or does Apache just have to 'lie back and enjoy it' while the browser does its wicked thing?