Re: How: size of uploaded file
| From: | (Richard Lynch) | Date: | Wed, 07 Jun 2000 08:09:23 +0000 |
| Subject: | Re: How: size of uploaded file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1185@lists.php.net to get a copy of this message | ||
In article <013c01bfcc5c$48554ab0$4400a8c0@shulya>, shulya@thepost.kiev.ua
("Vladislav Shulgin") wrote:
> I have a form which is carrying out file upload. The maximal size is
> specified in MAX_FILE_SIZE. At excess of this size PHP generate error to my
> page. How I can show the own message on this error?
Easy way: Don't have MAX_FILE_SIZE, but check $whatever_size and error out.
(Security Alert: Opens you up to Denial Of Service attack if somebody
wants to do upload after upload)
Slightly more involved:
Use Apache configuration directives (http://www.apache.org) with php_value
error_reporting 0 to force that one file to have PHP errors turned off
until after you've dealt with the upload. The $whatever and
$whatever_name values are distinctive for an over-sized file as opposed to
no file provided or an upload that somehow died in mid-upload. You'll
have to experiment to find all the combinations, or dig through the
archives for it.
(I never tried method 2, won't guarantee it works.)
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)