I'm getting hte following error when trying to upload a file via my script:
Warning: Unable to open '' for reading: Permission denied in xxx
I have a script that takes a file someone uploads and then just for now moves it to a directory. here is my code:
<?php
if ($_GET['action']== "" || !(isset($_GET['action'])))
{
echo "<h2>Upload m3u file</h2>";
echo "<form enctype= 'multipart/form-date' action='upload.php?action=doupload' method= 'post'>";
echo "upload m3u file: <input name= 'uploadm3u' type= 'file'>";
echo "<input type= 'submit' value= 'Upload File'>";
}
if ($_GET['action']== "doupload")
{
echo "uploading file....";
if ($HTTP_POST_FILES['uploadm3u']['tmp_name']== "none")
{
echo "No file uploaded!";
exit;
}
if ($_HTTP_POST_FILES['uploadm3u']['size']==0)
{
echo "File has 0 byte size";
exit;
}
$upfile= "C:\\upload".$_HTTP_POST_FILES['uploadm3u']['name'];
if (!copy($_HTTP_POST_FILES['uploadm3u']['tmp_name'], $upfile))
{
echo "Could not move file from temp to server";
exit;
}
echo "File upload OK";
}
?>
now C:\uploads is a real directory on my PC, and in my php.ini i have this for uploads:
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
any suggestions on why this is not working?