Jump to content

File Upload issues


melting_dog

Recommended Posts

Hi guys,

 

I need a little help. I am running a site in XAMPP whilst I develop it locally. I am trying to upload an image file. Heres my code:

 

$photo=$_POST['photo'];

 

$target_path = "uploads/";

 

$target_path = $target_path . basename( $_FILES['photo']['name']);

 

if(move_uploaded_file($_FILES['photo']['tmp_name'], $target_path)) {

    echo "The file has been uploaded";

} else{

    echo "There was an error uploading the file, please try again!";

}

 

But I get these errors:

 

Warning: move_uploaded_file(upload/ferriswheel.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/Applications/XAMPP/xamppfiles/temp/phpNwxq6I' to 'upload/ferriswheel.jpg' in /Applications/XAMPP/xamppfiles/htdocs/xampp/whatmycitywears/submitphotoprocess.php on line 53

 

Am I right in thinking this is some sort of issue with the temp directory? It seems to be putting it somewhere is XAMPSS folders rather then in my directory

 

Any help would be great!

Link to comment
https://forums.phpfreaks.com/topic/249673-file-upload-issues/
Share on other sites

OK I get a new meesage now:

 

Warning: move_uploaded_file(uploads/ferriswheel.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/xampp/whatmycitywears/submitphotoprocess.php on line 35

 

So I think I need to somehow set the permissions in XAMPP to allow upload?

Link to comment
https://forums.phpfreaks.com/topic/249673-file-upload-issues/#findComment-1281687
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.