php Upload problems

php.internals

Chris Woollard

23 years ago
I am having a problem with a php upload script. it will allow me to upload small files (about 1Mb) but not larger ones (less than the upload_max_filesize). Can you help diagnose what the problem is? I have PHP Version 4.2.2 on Red Hat Linux 9. the entry's in php.ini and scripts are as follows ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = /tmp ; Maximum allowed size for uploaded files. upload_max_filesize = 65M -------------------------------- index.htm <html> <head> <title>Administration - upload new files</title> </head> <body> <h1>Upload new news files</h1> <form enctype="multipart/form-data" action="upload.php" method=post> <!-- <input type="hidden" name="MAX_FILE_SIZE" value="1000000"> --> Upload this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </form> </body> </html> ------------------------------------- phpupload.php <? $uploaddir = '/var/www/html/incoming//'; $uploadfile = $uploaddir. $_FILES['userfile']['name']; print "<pre>"; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { chmod ("$uploadfile", 0766); print "File is valid, and was successfully uploaded.\n\n"; print "Here's some more debugging info:\n\n"; print_r($_FILES); } else { print "Possible file upload attack! Here's some debugging info:\n\n"; print_r($_FILES); } ?> ---------------------------------------------------------------------------- Manhattan Advanced Property Management Software http://www.manhattansoftware.com Raindrop Group 40 Piccadilly London W1J ODR Tel: +44 (0)207 734 1091 Fax: +44 (0)207 734 1095 This e-mail contains proprietary information some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail.

Derick Rethans

23 years ago
On Wed, 16 Jul 2003, Chris Woollard wrote:
> > I am having a problem with a php upload script. > > it will allow me to upload small files (about 1Mb) but not larger ones (less > than the upload_max_filesize). > > Can you help diagnose what the problem is?
See php.net/support.php to find ways to get support. Derick
-- "Interpreting what the GPL actually means is a job best left to those that read the future by examining animal entrails." ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ International PHP Magazine http://php-mag.net/ -------------------------------------------------------------------------

Joerg Behrens

23 years ago
----- Original Message ----- From: "Chris Woollard" <cmw@raindrop.co.uk> To: <internals@lists.php.net> Sent: Wednesday, July 16, 2003 3:10 PM Subject: [PHP-DEV] php Upload problems
> > I am having a problem with a php upload script. > > it will allow me to upload small files (about 1Mb) but not larger ones
(less
> than the upload_max_filesize). > > Can you help diagnose what the problem is? > > I have PHP Version 4.2.2 on Red Hat Linux 9.
RedHat ?... Check also LimitRequestBody in your httpd.conf. When i'm remember right they have a default setting round about 512000bytes or so. Dont forget to restart your Apache after the changes. And next time use the php-general list. regards Joerg Behrens
-- TakeNet GmbH Mobil: 0171/60 57 963 D-97080 Wuerzburg Tel: +49 931 903-2243 Alfred-Nobel-Straße 20 Fax: +49 931 903-3025