File Upload size
Moderator: General Moderators
-
khawarikhan
- Forum Newbie
- Posts: 8
- Joined: Tue Feb 15, 2005 3:45 pm
File Upload size
Hi Eveybody,
I had posted this message before and someone did reply to the post but that solution didn't work. Actually, I am trying to upload files bigger than 500K on my server. But its not allowing it to upload those files. I checked that I am not passing any variable MAX_FILE_SIZE as a hidden field in the form and have checked the php.ini file and it says that the Max size to upload is 2MB which I set to 5MB now but still it not working. Anyone has any idea how to remedy this problem? Thanks for help
Khawar Khan
I had posted this message before and someone did reply to the post but that solution didn't work. Actually, I am trying to upload files bigger than 500K on my server. But its not allowing it to upload those files. I checked that I am not passing any variable MAX_FILE_SIZE as a hidden field in the form and have checked the php.ini file and it says that the Max size to upload is 2MB which I set to 5MB now but still it not working. Anyone has any idea how to remedy this problem? Thanks for help
Khawar Khan
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
-
khawarikhan
- Forum Newbie
- Posts: 8
- Joined: Tue Feb 15, 2005 3:45 pm
thanks for replying
I tried to print this Variable after I hit the upload button, what I see only is........."The page cannot be displayed" error.........it doesn't show anything until the upload file size is less than 500K
Khawar
Khawar
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: thanks for replying
Show some code please (and the bit where you echo/print the error element from $_FILES)khawarikhan wrote:I tried to print this Variable after I hit the upload button, what I see only is........."The page cannot be displayed" error.........it doesn't show anything until the upload file size is less than 500K![]()
Khawar
-
khawarikhan
- Forum Newbie
- Posts: 8
- Joined: Tue Feb 15, 2005 3:45 pm
here is the code
Code: Select all
if ($save)
{
if ($Image=="") {
$upload_message="You have not uploaded any file <br>\n";
} else {
if (is_uploaded_file($Image)) {
$location="LOCATION GOES HERE" . $Image_name;
copy("$Image", $location);
$file_error1 = $_FILESї'$Image_name']ї'error'];
echo "eror1: $file_error1<br>";
if (file_exists($location)) {
$upload_message="$Image_name uploaded successfully!<br>";
} else {
$upload_message="There was a problem uploading your file to $location. Please check the path and permissions.";
}
Header("Location: import.php?filename=$Image_name");
} else {
$upload_message="Wrong type of file, please try again!";
}
}
}feyd | please use
Code: Select all
tags while theCode: Select all
tags are offline![/color]- smpdawg
- Forum Contributor
- Posts: 292
- Joined: Thu Jan 27, 2005 3:10 pm
- Location: Houston, TX
- Contact:
As mentioned in other posts you need to look at post_max_size and file_max_size. If they are each set to some value that is larger than the files you are expecting and the transfer still fails you have another problem.
And here is what your problem may be. There is a flag called LimitRequestBody in Apache that will give the illusion of a configuration error in PHP. This only affects certain installs of Apache and I have seen it happen in Red Hat Linux.
This flag is set to a value in the neighborhood of 500K depending on the installation so if you transfer fails with files that are bigger than ~500K and work with smaller files this may be your problem.
http://www.apacheref.com/ref/http_core/ ... tBody.html
BTW - Even though this page talks about Apache 1.3 I have seen it happen to Apache 2.0.
And here is what your problem may be. There is a flag called LimitRequestBody in Apache that will give the illusion of a configuration error in PHP. This only affects certain installs of Apache and I have seen it happen in Red Hat Linux.
This flag is set to a value in the neighborhood of 500K depending on the installation so if you transfer fails with files that are bigger than ~500K and work with smaller files this may be your problem.
http://www.apacheref.com/ref/http_core/ ... tBody.html
BTW - Even though this page talks about Apache 1.3 I have seen it happen to Apache 2.0.
-
khawarikhan
- Forum Newbie
- Posts: 8
- Joined: Tue Feb 15, 2005 3:45 pm
RE: smpdawg
So how can I increase the size for that then?
Khawar
Khawar
-
khawarikhan
- Forum Newbie
- Posts: 8
- Joined: Tue Feb 15, 2005 3:45 pm
RE: fyed
Sorry for pasting the code without the
Code: Select all
block........I'll do it next times for sure.........
I tried outputting garbage data, a lot of it actually, but still the same error with IE...........page cannot be displayed.........
Khawar- smpdawg
- Forum Contributor
- Posts: 292
- Joined: Thu Jan 27, 2005 3:10 pm
- Location: Houston, TX
- Contact:
Re: RE: smpdawg
post_max_size is in your php.ini. LimitRequestBody would be in httpd.conf or could be loaded from an external file that httpd.conf is pointing at.khawarikhan wrote:So how can I increase the size for that then?
Khawar
Verify post_max_size and upload_max_filesize in your php.ini before you check the Apache configuration file.
If php.ini looks normal, read this page to get an idea where LimitRequestBody can be. I cannot say for a fact where you will find it because each distro is different.
https://www.redhat.com/archives/taroon- ... 00340.html