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? Link to comment https://forums.phpfreaks.com/topic/109049-file-upload-help/ Share on other sites More sharing options...
LooieENG Posted June 6, 2008 Share Posted June 6, 2008 It should be set to 777 Link to comment https://forums.phpfreaks.com/topic/109049-file-upload-help/#findComment-559440 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. Link to comment https://forums.phpfreaks.com/topic/109049-file-upload-help/#findComment-559441 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.