Just a warning. This method doesn't work right under Windows. The file is fully uploaded, then it is tested if the max size of the file is overdone. If the file size is 10 GB, the file is fully uploaded first, then... doesn't matter ... but the program will work, and after it finish uploading, it tells the visitor that the file is too big.
Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] ----- Original Message ----- From: "fliptop" <[EMAIL PROTECTED]> To: "Mike Harrison" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, July 18, 2003 4:19 PM Subject: Re: File uploading On Fri, 18 Jul 2003 at 12:03, Mike Harrison opined: MH:I have a perl program that allows a user to upload a file (either .jpg or MH:.gif) to the server, and returns a message if it exceeds a specified size MH:(in my case 100kB). Currently (and don't laugh - I am new to perl), I go MH:through the motions of uploading the file in 1024-byte blocks (in binary MH:mode), and increment a counter with each block. If the counter exceeds 100 MH:(i.e. greater than 100kB), then it exits the loop, displays a warning MH:message and deletes the file. MH: MH:I am sure there would have to be an easier and more efficient way of doing MH:this - that is, somehow finding out how large the file is without having to MH:download it first. MH: MH:Does perl have a module that can check the size of the file? And for that MH:matter, its type (.jpg, .gif etc.)? hi mike - CGI provides a way to indicate if an form post exceeds a pre-determined size limit. it's the $CGI::POST_MAX variable, and if you wanted to limit uploads to 100kbytes (for example), you'd do something like this: use CGI; $CGI::POST_MAX = 100 * 1024; my $cgi = new CGI; if ($cgi->cgi_error) { # alert the user their post exceeded the limit exit(); } you can find out more information by reading perldoc CGI -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]