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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.