Tanalis has asked for the wisdom of the Perl Monks concerning the following question:
I'm currently using CGI::Application to provide some dynamic web content for a community website that I support.
As part of this, we want to allow users to upload an image for their personal profiles, with a maximum size of 80kb. This has been implemented, using the $CGI::POST_MAX variable to limit the size of uploads.
This seems to work well: if a file over the limit is uploaded, it's ignored, and the script returns (automatically, not through my scripting) to the site's homepage. What I'd like to do, however, is to catch the error, and display an error message, so that the user at least knows what went wrong.
I've looked through the docs for CGI, super-searched here and searched the web for some hints about how to do this, but I'm having no luck so far.
Does anyone know of a way to detect the fact that a file upload has exceeded the $CGI::POST_MAX limit, and hence failed, so that an error can be displayed? As the file doesn't actually get uploaded, I presume that the upload error-detection code given in the CGI module wouldn't work in this case.
Any suggestions would be appreciated.
-- Foxcub
#include www.liquidfusion.org.uk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Detecting when a $CGI::POST_MAX limit is exceeded
by rob_au (Abbot) on May 26, 2003 at 10:01 UTC | |
|
Re: Detecting when a $CGI::POST_MAX limit is exceeded
by benn (Vicar) on May 26, 2003 at 23:43 UTC | |
|
Re: Detecting when a $CGI::POST_MAX limit is exceeded
by Hagbone (Monk) on May 26, 2003 at 21:54 UTC | |
by Hagbone (Monk) on May 26, 2003 at 21:58 UTC |