Jump to content

file upload help


Gazz1982

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.