Forum Moderators: coopster
I have my own dedicated Linux server and am trying to configure it to allow uploads larger than 512kb.
Currently, anything larger goes to a '404' page or hangs on a white screen - things that I am sure a lot of you are aware with using this function!?
Anyways, I have updated the following in Linux...
PHP.ini
MAX_FILE_SIZE, MAX_POST_SIZE, and the various time outs, memory variables - all set to above and beyond what I will need.
PHP.conf
Changed the LimitBodyRequest from 512kb to 32mb
HTTPD.conf
Checked for the LimitBodyRequest but it isnt there.
Finally, I've also set a MAX_FILE_SIZE hidden variable on my form to override anything I've forgot.
I've done all I can think of - restarted Redhat after the changes (which show ok online in phpinfo())
Really frustrating now... anyone got any other ideas?
Thanks for any help, Paul.
p.s. could I post the PHP.ini for anyone to look at?
Thats them!
I think the script is pretty solid - as I say, it uploads anything sub 512kb with no probs.
It must be a LimitBodyRequest problem, but I have altered that value in the php.conf file.
Is there anywhere else I should be looking for this value - i.e. should I actually ADD it to httpd.conf even though currently it isnt in there at all?
Thanks for any help, Paul.
Here is the code to upload the image as requested...
if(isset($_POST['Submit']))
{
$size = 150; // the thumbnail height
$filedir = '../images/'; // the directory for the original image - '../images/'
$thumbdir = '../images/'; // the directory for the thumbnail image
$prefix = 'small_'; // the prefix to be added to the original name
$mode = '0666';
$userfile_name = $_FILES['image']['name'];
$userfile_tmp = $_FILES['image']['tmp_name'];
$userfile_size = $_FILES['image']['size'];
$userfile_type = $_FILES['image']['type'];
if ($_FILES['image']['name']!="")
{
$prod_img = $filedir.$userfile_name;
$prod_img_thumb = $thumbdir.$prefix.$userfile_name;
move_uploaded_file($userfile_tmp, $prod_img);
chmod ($prod_img, octdec($mode));
$sizes = getimagesize($prod_img);
$aspect_ratio = $sizes[1]/$sizes[0];
if ($sizes[1] <= $size)
{
$new_width = $sizes[0];
$new_height = $sizes[1];
}else{
$new_height = $size;
$new_width = abs($new_height/$aspect_ratio);
}
$destimg=ImageCreateTrueColor($new_width,$new_height) or die('Problem In Creating image');
$srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image');
ImageCopyResized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die('Problem In resizing');
ImageJPEG($destimg,$prod_img_thumb,90) or die('Problem In saving');
imagedestroy($destimg);
}
}
As I mentioned, this script uploads <512kb files fine...
Any help to anyone?
Cheers, Paul
So try putting something like this at the top of the script:
<?php
echo 'hi there';
print_r($_FILES);
die;
Upload a file, and see what happens.
The script definately gets called - I have already put a debug echo inside the function loop that echos when an image is uploaded.
Plus, images under 512kb get uploaded fine.
I am sure it must be to do with the LimitRequestBody in the php.conf file.
I have tried changing the value, commenting the whole thing out and even removing the variable all together with no effect.
I have restarted the web server after each change - is there anyway I can check the value has stuck in PHP?