By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,873 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

Trouble uploading images

P: n/a
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

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 18 Dec 2004 12:43:47 -0800, la***********@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 / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

P: n/a
la***********@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

Jul 17 '05 #3

P: n/a
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:
la***********@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


Jul 17 '05 #4

P: n/a
la***********@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

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.