[ciapug] File Upload

Tony Bibbs tony at tonybibbs.com
Tue Feb 21 08:19:52 CST 2006


You mean by calling something like this?

http://us3.php.net/set-error-handler

--Tony

Carl Olsen wrote:
> I ran into an unusual situation today creating a file upload script.  I have
> the php.ini settings for memory_limit, upload_max_filesize, and
> post_max_size all set to 10M.  I have a form with a hidden field
> MAX_FILE_SIZE just before the file input box set to 10000000 (10 million
> bytes, slightly less than 10M).  I have a function that checks both the file
> extension and the file type, so it only allows files of certain types to be
> uploaded.  I get unusual results.  When I upload most files that do not fit
> the required type, it give me one of my custom error messages.  When I
> upload a file that is too big, it doesn't do anything (MAX_FILE_SIZE
> prevents the form from posting).  However, when I upload a file with an .exe
> file extension that is 54MB, I get a machine error that starts out "PHP
> Warning" at the bottom of the page.
> 
> What I would really like to do is figure out how to write some PHP code to
> intercept the machine error and display a custom error on the page, but it
> appears to be outside the scope of any PHP code I can insert into the page.
> Has anyone seen this before?
> 
> Carl Olsen
> 
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug


More information about the ciapug mailing list