daracraft Posted April 30, 2007 Share Posted April 30, 2007 I really appreciate your help with this issue. I'm looking for help so that i can fix the issue or for someone that might be able to go in and fix the issue - having a hard time finding a PHP guy/girl that doesn't cost a fortune or has the time to work on it now. I just moved from one server to another and now this function doesn't work. I know you needed the error so I pasted it below: (This is the error that I get when I try to upload an image in my admin backroom. I need to upload through this function as it places the image in the appropriate pages on the site and resizes, etc. the product.) Warning: move_uploaded_file(babiesnb/public_html/imageUpload/productstempfile.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/babiesnb/public_html/bnb/admin/upload_prod_img.php on line 64 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpiyYNLV' to 'babiesnb/public_html/imageUpload/productstempfile.jpg' in /home/babiesnb/public_html/bnb/admin/upload_prod_img.php on line 64 File size exceeds security limit. Try a smaller file size.Array ( [userfile] => Array ( [name] => Blue hills.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpiyYNLV [error] => 0 => 28521 ) The script in this file is below: include("adminconfig.inc.php"); $thispage = 'upload_prod_img'; // allowed admin user check $query="SELECT * FROM ADMIN_sessions INNER JOIN ADMIN_rights ON ADMIN_sessions.userid = ADMIN_rights.userid WHERE ADMIN_sessions.seshid='$seshid'"; $result=mysql_query($query); $menudata=mysql_fetch_array($result); if($menudata[zip]=='no') { // not a good user echo "Access denied. Contact your site administrator."; } else { // format markup chunks $header="<html><head><title>".$sitename."</title> <link href=\"".$css_loc."\" rel=\"stylesheet\" type=\"text/css\"> <script language=javascript type=\"text/javascript\" src=\"".$js_loc."\"></script> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> </head><body><table cellpadding=4 cellspacing=4 border=0><tr><td>"; $footer="</td></tr></table></body></html>"; if ($_POST[auth]=='go') { if ("image/pjpeg" != $_FILES['userfile']['type'] && "image/jpeg" != $_FILES['userfile']['type']) { $errorlog= "Only JPG format files can be uploaded to the products folder."; echo $header.$errorlog.$footer; } else { if($_POST[newfilename]==3) { $suffix='ic.jpg'; } elseif($_POST[newfilename]==2) { $suffix='ty.jpg'; } else { $suffix='sample.jpg'; $suffix2='sm.jpg'; } $uploaddir = '/home/public_html/imageUpload/products/'; $produrl= 'http://www.babiesnbells.com/public_html/imageUpload/'; $uploadfile = $uploaddir . 'tempfile.jpg'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { $prodfilename = $_POST[pid]."_".$suffix; $thumbname = $_POST[pid]."_".$suffix2; $image_details = getimagesize($uploadfile); $imagesize_x = $image_details[0]; $imagesize_y = $image_details[1]; if($_POST[newfilename]==2) { if($imagesize_x>'200') { $big_width='200'; } else { $big_width=$imagesize_x; } $thumb_width='180'; } else { if($imagesize_x>'400') { $big_width='400'; } else { $big_width=$imagesize_x; } $thumb_width='180'; } function resizeuploads($image_path, $image_id, $file, $width, $height, $compression) { $src_img = imagecreatefromJPEG($image_path.$file); $new_h = $height; $new_w = $width; $dst_img = imagecreatetruecolor($new_w,$new_h); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $new_w, $new_h, imagesx($src_img), imagesy($src_img)); imagejpeg($dst_img, $image_path.$image_id, $compression); } $dest_x = (($big_width * $imagesize_y) / $imagesize_x); $thumbdest_x = (($thumb_width * $imagesize_y) / $imagesize_x); resizeuploads($uploaddir, $thumbname, 'tempfile.jpg', $thumb_width, $thumbdest_x, 70); if($_POST[newfilename]!=3) { resizeuploads($uploaddir,$prodfilename, 'tempfile.jpg', $big_width, $dest_x, 80); } echo $header; echo "File is valid, and was successfully uploaded.<br> "; echo "<img src=".$produrl.$prodfilename." border=0><br>".$produrl.$prodfilename."<br>"; echo " <br><br>"; echo $footer; } else { echo $header; print "<pre>"; print "File size exceeds security limit. Try a smaller file size."; print_r($_FILES); print "</pre>"; echo $footer; } } // end if jpeg } else { echo $header; echo "$errorlog<br> File Upload:<br>"; echo "<form enctype=\"multipart/form-data\" action=\"upload_prod_img.php\" method=\"post\"> The form below allows you to update the product images associated with this product. Please be aware that uploading additional images for a product with images already associated with it will overwrite previous images. If you are uploading an image for a folded note, you will need to first locate the primary card for that folded note and upload the image there. The thumbnails and sample images that showcase a folded note by itself will need to be uploaded as main content from the detail page of that specific \"Thank You\" (Folded Note) item. <br><br> <input type=\"hidden\" name=\"seshid\" value=\"".$seshid."\" /> <input type=\"hidden\" name=\"auth\" value=\"go\" /> <input type=\"hidden\" name=pid value=\"$_GET[pid]\"> Image Type: <select name=newfilename> <option value=1 selected>Main Product</OPTION> <option value=2>Folded Note</OPTION> <option value=3>Inside Card</OPTION> </select><br><br> <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1000000\" /> Send this file: <input name=\"userfile\" type=\"file\" /> <input type=\"submit\" value=\"Send File\" /> </form>"; echo $footer; } } ?> Link to comment https://forums.phpfreaks.com/topic/49325-php-help-with-upload-of-images-to-server/ Share on other sites More sharing options...
trq Posted April 30, 2007 Share Posted April 30, 2007 This is quite simply a permissions error. Make sure you have read/write access to the directoy you are trying to move the file to. And please, lay off the red text! Link to comment https://forums.phpfreaks.com/topic/49325-php-help-with-upload-of-images-to-server/#findComment-241703 Share on other sites More sharing options...
daracraft Posted April 30, 2007 Author Share Posted April 30, 2007 Thank you for your input!!! That's what i thought - sorry about the red text!! What kind of file would I check in for read/write access permission? config file? Another upload image file? Any ideas?j What kind of script do i look for? What might the line with permissions have in it as far as code? I'm a newbie and trying to still understand PHP. Link to comment https://forums.phpfreaks.com/topic/49325-php-help-with-upload-of-images-to-server/#findComment-241747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.