codexx Posted June 11, 2007 Share Posted June 11, 2007 Hey Everyone, I'm having a problem with this image upload script since I upgraded Apache. I noticed in my .htaccess files it no longer let me set maxupload size and it blanks it out saying it is now controlled by the .ini file. This script worked fine till the upgrades. The error I get is for files over 309 KB. Below is the script... I've blanked out alot that wasn't related to this issue.. also.. The error i'm getting is.. Warning: imagejpeg() [function.imagejpeg]: Unable to open 'tmp/Sean-101_6538.JPG' for writing: Permission denied in /home/myvibe/public_html/user/imageuploader.php on line 46 <? 1 include("../assets/includes/header.php"); ?> 2 3 <div id="main"> 4 <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="73%" height="281" valign="top" bgcolor="#FFFFFF"><div align="left"><span style="font-weight: bold"> </span> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <img src="*****" width="556" height="55" /><br /> <table width="100%" border="0" cellspacing="5" cellpadding="5"> <tr> <td height="241" valign="top"> <?php ini_set("memory_limit","50M"); if(isset($_POST['Submit'])) { if($_FILES['image']['type'] == 'image/pjpeg' || $_FILES['image']['type'] == 'image/gif'){ $size = 90; // the thumbnail width $maxfile = '200000'; //maximum file size to upload $mode = '0666'; $userfile_name = $_FILES['image']['name']; $userfile_tmp = $_FILES['image']['tmp_name']; $userfile_size = $_FILES['image']['size']; $userfile_type = $_FILES['image']['type']; if (isset($_FILES['image']['name'])) { $prod_img = "tmp/".$_SESSION['onlineuser']."-original".$_FILES['image']['name']; $prod_img_thumb = "tmp/".$_SESSION['onlineuser']."-".$_FILES['image']['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[0] <= $size) { $new_width = $sizes[0]; $new_height = $sizes[1]; }else{ $new_height = $size; $new_width = abs($new_height/$aspect_ratio); 42 } 43 $destimg=imagecreatetruecolor($new_width,$new_height) or die('Problem In Creating image'); 44 $srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image'); 45 ImageCopyResampled($destimg, $srcimg, 0, 0, 0, 0, $new_width, $new_height, $sizes[0], $sizes[1]) or die('Problem In resampling'); 46 ImageJPEG($destimg,$prod_img_thumb,90) or die('Problem In saving'); imagedestroy($destimg); } //Update User Account Quote Link to comment https://forums.phpfreaks.com/topic/55038-image-upload-failing-large-file-size/ Share on other sites More sharing options...
codexx Posted June 11, 2007 Author Share Posted June 11, 2007 Just to add on.. the error code it gives mentions missing file or permission.. The exact file it is trying to find does exist.. and its CHMOD is at 644 Quote Link to comment https://forums.phpfreaks.com/topic/55038-image-upload-failing-large-file-size/#findComment-272078 Share on other sites More sharing options...
pocobueno1388 Posted June 11, 2007 Share Posted June 11, 2007 I'm pretty sure the permission needs to be 777. Quote Link to comment https://forums.phpfreaks.com/topic/55038-image-upload-failing-large-file-size/#findComment-272081 Share on other sites More sharing options...
codexx Posted June 11, 2007 Author Share Posted June 11, 2007 I'm just wondering why it works great for files under like 350kb but anything over it fails on? If I have to I guess I can re-chmod the $destimg Quote Link to comment https://forums.phpfreaks.com/topic/55038-image-upload-failing-large-file-size/#findComment-272082 Share on other sites More sharing options...
codexx Posted June 11, 2007 Author Share Posted June 11, 2007 I added a .htaccess file just incase with a larger upload file size.. Still nothing Quote Link to comment https://forums.phpfreaks.com/topic/55038-image-upload-failing-large-file-size/#findComment-272094 Share on other sites More sharing options...
codexx Posted June 11, 2007 Author Share Posted June 11, 2007 Does anyone think its the max file size allowed on an upload or is it the script? Quote Link to comment https://forums.phpfreaks.com/topic/55038-image-upload-failing-large-file-size/#findComment-272267 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.