Hello i have some issues with my file uploading at localhost. I am using XAMPP. I have looked at php.ini and ensured file_uploads = On, but the warnings won't disappear and the files don't get uploaded. Furthermore i have tried to look at some of the other pages with the same topic without luck.
My errors:
Warning: move_uploaded_file(myfiles/img.png): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/website/changethesettings.php on line 118
Warning: move_uploaded_file(): Unable to move '/Applications/XAMPP/xamppfiles/temp/phpRGfg7t' to 'myfiles/img.jpg' in /Applications/XAMPP/xamppfiles/htdocs/website/changethesettings.php on line 118
this is my HTML:
<form method="post" action="changethesettings.php" enctype="multipart/form-data">
<input id="file" type="file" name="file"/>
<input type="submit" value="submit file"/>
</form>
This is my PHP code (changethesettings.php):
$target_dir = "myfiles/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
-> line 118 if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
echo "The file ". basename( $_FILES["file"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
die("<br> the end");
It should be mentioned that i have a .htaccess. I don't know if that might be the cause of the warning:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Options -Indexes
Thanks