This is a discussion on Trouble uploading images within the PHP Language forums, part of the PHP Programming Forums category; Hi, I'm using PHP 4 and I am submitting some images in a form with <form name=addProductForm ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi, I'm using PHP 4 and I am submitting some images in a form with
<form name=addProductForm enctype="multipart/form-data" method=post action="add_product_response.php"> <input type=file name='prodImg' id='prodImg'> However, sometimes, the images fail to upload, even though the form submits fine. When I try to print out the values from the $_FILES['prodImg'] array, I get name: ONDA076.jpg type: tmp_name: error: 3 size: 0 What does an error code of 3 mean? I would prefer not to do anything to my image (take it to PhotoShop and edit it, etc.). Is there something else I can do so that it will upload? Thanks, - Dave |
|
|||
|
On 18 Dec 2004 12:43:47 -0800, laredotornado@zipmail.com wrote:
>Hi, I'm using PHP 4 and I am submitting some images in a form with > ><form name=addProductForm enctype="multipart/form-data" method=post >action="add_product_response.php"> ><input type=file name='prodImg' id='prodImg'> > >However, sometimes, the images fail to upload, even though the form >submits fine. When I try to print out the values from the >$_FILES['prodImg'] array, I get > >name: ONDA076.jpg >type: >tmp_name: >error: 3 >size: 0 > >What does an error code of 3 mean? I would prefer not to do anything >to my image (take it to PhotoShop and edit it, etc.). Is there >something else I can do so that it will upload? http://uk2.php.net/manual/en/feature...oad.errors.php -- Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool |
|
|||
|
laredotornado@zipmail.com wrote:
> Hi, I'm using PHP 4 and I am submitting some images in a form with ..... > However, sometimes, the images fail to upload, even though the form > submits fine. When I try to print out the values from the > $_FILES['prodImg'] array, I get > > name: ONDA076.jpg > type: > tmp_name: > error: 3 > size: 0 > > What does an error code of 3 mean? I would prefer not to do anything > to my image (take it to PhotoShop and edit it, etc.). Is there > something else I can do so that it will upload? This suggests that the file is to large for your current configuration. There are at least 2 config settings that is worth looking at: upload_max_filesize http://www.php.net/manual/en/ini.sec...d-max-filesize This value can only be changed in php.ini, httpd.conf (asuming you're using apache), or a .htaccess file. The second setting is: post_max_size http://www.php.net/manual/en/ini.sec....post-max-size This value can only be changed the same places as upload_max_filesize. -- Tommy |
|
|||
|
Thanks for the advice. I don't have control over the php.ini file, but
I tried adding these settings // set max file upload sizes ini_set("upload_max_filesize", "10M"); ini_set("post_max_size", "12M"); This is well above what the size of the file I'm uploading. However, I get the same result. Apache is the web server. I have a hunch the web server is cutting me off. What would the .htaccess file look like since I also don't have control over the httpd.conf file? Thanks again, - Dave Tommy Gildseth wrote: > laredotornado@zipmail.com wrote: > > > Hi, I'm using PHP 4 and I am submitting some images in a form with > .... > > However, sometimes, the images fail to upload, even though the form > > submits fine. When I try to print out the values from the > > $_FILES['prodImg'] array, I get > > > > name: ONDA076.jpg > > type: > > tmp_name: > > error: 3 > > size: 0 > > > > What does an error code of 3 mean? I would prefer not to do anything > > to my image (take it to PhotoShop and edit it, etc.). Is there > > something else I can do so that it will upload? > > This suggests that the file is to large for your current configuration. > > There are at least 2 config settings that is worth looking at: > upload_max_filesize > http://www.php.net/manual/en/ini.sec...d-max-filesize > This value can only be changed in php.ini, httpd.conf (asuming you're using > apache), or a .htaccess file. > > The second setting is: > post_max_size > http://www.php.net/manual/en/ini.sec....post-max-size > This value can only be changed the same places as upload_max_filesize. > > -- > Tommy |
|
|||
|
laredotornado@zipmail.com wrote:
> Thanks for the advice. I don't have control over the php.ini file, but > I tried adding these settings > > // set max file upload sizes > ini_set("upload_max_filesize", "10M"); > ini_set("post_max_size", "12M"); > No, as I said. you can't set these values using ini_set(), since they have to be set, before the script is run. > This is well above what the size of the file I'm uploading. However, I > get the same result. Apache is the web server. I have a hunch the web > server is cutting me off. What would the .htaccess file look like > since I also don't have control over the httpd.conf file? put this in your .htaccess file: php_value post_max_size 22M php_value upload_max_filesize 10M This may or may not work, depending on the restrictions your webhost has set in the httpd.conf file, with regards to what you may do in the .htaccess file. -- Tommy |