Gazz1982 Posted June 6, 2008 Share Posted June 6, 2008 I'm trying to upload images to a directory on my server using: <form enctype="multipart/form-data" action="uploader.php" method="POST"> Please choose a file: <input name="upfile" type="file" /><br /> <input type="submit" value="Upload" /> </form> <?php $uploaddir = "uploads/"; $uploadfile = $uploaddir . $_FILES['upfile']['name']; if (move_uploaded_file($_FILES['upfile']['tmp_name'], $uploadfile)) { print("File upload success"); } else { print("Failed"); } ?> Warning: move_uploaded_file(uploads/image001.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /var/www/uploader.php on line 5 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpq2fKYW' to 'uploads/image001.jpg' in /var/www/uploader.php on line 5 Failed I've set dir uploads/ permissions using chmod 766 uploads Any ideas? Quote Link to comment Share on other sites More sharing options...
LooieENG Posted June 6, 2008 Share Posted June 6, 2008 It should be set to 777 Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 6, 2008 Share Posted June 6, 2008 You want the directory to be 755. 766 is "all, exec/read, exec/read". You want the script to read/write, not exec/read. 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.