Re: MAX_FILE_SIZE : warning

From: Date: Wed, 09 May 2001 11:18:21 +0000
Subject: Re: MAX_FILE_SIZE : warning
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-52068@lists.php.net to get a copy of this message
Thanks :) -- [ www.eksperten.dk ] Scandinavias biggest IT forum. ""James Holloway"" <james@towntalk.co.uk> wrote in message news:9db61u$7d9$1@toye.p.sourceforge.net... > Jacob, > > When you upload a file, it appends a few of its own variables. One of them > is size - assuming the file is a variable called $file: > > if ($file_size > $max_size) { > echo $file_name . " was too big!"; > } > > Also, you could check for Mime types. > > if ($file_type != "image/jpeg" || $file_type != "image/pjpeg") { > echo "We only like jpegs!"; > } > > As a footnote, 500Kb is 512000 bytes (1024 bytes in a Kb). > > James. > > > When I set <INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" > > VALUE="500000"> and a > > user uploads a file bigger than 500000 my script prints a warning. > > > > How can I use MAX_FILE_SIZE and avoid that warning so that I can print my > > own error message to the user ? > > > > :) Jacob > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#52068) next »