kpetsche20 Posted May 18, 2008 Share Posted May 18, 2008 I'm trying to make a script that allows me to upload a image to my sever from a form then have it put into a folder that is associated with a specific username. When I try to upload I get an error Warning: move_uploaded_file(/home/bluearro/public_html/imageupload/images/Static_Cuz(2).jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/bluearro/public_html/imageupload/handle.php on line 8 Here is a link to the script, the problem can be replicated in 5 seconds. http://bluearrowhosting.com/imageupload/ Here's the code <?php $target = "/home/bluearro/public_html/imageupload/images"; $target .= $_POST['login']."/"; $target2 = $target.$_FILES['file']['name']; $ok=1; if (!is_dir($target)) mkdir($target,0777); $new=move_uploaded_file($_FILES['file']['tmp_name'], $target2); $ext=getExtension($_FILES['file']['name']); $goodext = array('jpg','jpeg','png','bmp','gif'); if (in_array($ext,$goodext)) $extcheck=true; $size=filesize($_FILES['file']['tmp_name']); $height=$randomsss[0]=getimagesize($target2); $width=$randomsss[1]=getimagesize($target2); if ($width<120 && $height<100) $sizecheck=true; if ($size < $MAX_SIZE*1024 && $new == true && $extcheck==true && $sizecheck == true) echo "The file ". basename( $_FILES['file']['name']). " has been uploaded"; else { echo "Sorry, there was a problem uploading your file."; if ($size > $MAX_SIZE*1024) {echo " It seems that your file is too big.";} else if ($extcheck == false) {echo " It seems you tried to upload an unallowed file type. ";echo $ext;} else if ($sizecheck==false) {echo "The width and/or height are too big.";}} ?> Quote Link to comment Share on other sites More sharing options...
LooieENG Posted May 18, 2008 Share Posted May 18, 2008 is the folder "images" CHMODed to 777? Quote Link to comment 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.