Jump to content

file upload


justinh

Recommended Posts

Having a little trouble getting my upload.php to work.

 

Uploader is in a folder called stbs, also in the stbs folder, is a folder called testing. So i thought this would work:

 

<?php

$target_path = "/testing/";

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

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

echo "The file". basename($_FILES['uploadedfile']['name'])." has been uploaded";

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

}

?>

 

but this is returning an error of:

 

 

Warning: move_uploaded_file(/testing/hmmmm.txt) [function.move-uploaded-file]: failed to open stream: No such file or directory in /homepages/29/d119570661/htdocs/wmptest.com/stbs/upload.php on line 7

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpK0nMSR' to '/testing/hmmmm.txt' in /homepages/29/d119570661/htdocs/wmptest.com/stbs/upload.php on line 7
There was an error uploading the file, please try again! 

 

hmmm...

 

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

nvm fixed it

<?php

$target_path = "testing/";

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

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

echo "The file". basename($_FILES['uploadedfile']['name'])." has been uploaded";

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

}

?>

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