move_uploaded_file seems to allways return false, and when I look in the uploads folder, it is indeed empty. My code should not differ from the code in the video. $targetPath = "uploads/"; $targetPath = $targetPath . basename($_FILES['uploadedfile']['name']); if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $targetPath)) { echo 'The file ' . basename($_FILES['uploadedfile']['name']) . ' has been uploaded.'; } else { echo 'There was an error uploading the file, please try again.'; }
I have turned on error reporting, and I get a warning saying Permission denied in /usr/home/ole/html/uploader.php. I am logged in on the owner of the folder and it's rights are as follows: rwxr-xr-x Can it have anything to do with the fact theat I am creating the PHP files and upload folder on my own personal PC and then moving it over to the web server?
You are right. I thought I had to log on to an account in Ubuntu with sufficient permissions and then run PHP from there, but it appears as if *Apache 2 and PHP creates their own accounts*. Apache: _www-data_ PHP: _www_ This explains the issue, as in my case; only the owner [ole] has write-permissions!
Thanks for this tutorial John..Appreciated.
thank you so much, you explain things way better than my teacher, you are a big help thanx
+tika “tikarobinson” robinson no problem!
How do you save this file to a database? John Morris
move_uploaded_file seems to allways return false, and when I look in the uploads folder, it is indeed empty.
My code should not differ from the code in the video.
$targetPath = "uploads/";
$targetPath = $targetPath . basename($_FILES['uploadedfile']['name']);
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $targetPath)) {
echo 'The file ' . basename($_FILES['uploadedfile']['name']) . ' has been uploaded.';
} else {
echo 'There was an error uploading the file, please try again.';
}
I have turned on error reporting, and I get a warning saying
Permission denied in /usr/home/ole/html/uploader.php.
I am logged in on the owner of the folder and it's rights are as follows: rwxr-xr-x
Can it have anything to do with the fact theat I am creating the PHP files and upload
folder on my own personal PC and then moving it over to the web server?
it's file permissions. i have the same problem and none of these videos even talk about the subject.
You are right. I thought I had to log on to an account in Ubuntu with sufficient permissions and then run PHP from there, but it appears as if *Apache 2 and PHP creates their own accounts*.
Apache: _www-data_
PHP: _www_
This explains the issue, as in my case; only the owner [ole] has write-permissions!
sir you are great!
thank you for this :)
No problem