shankar_nsm Posted July 28, 2007 Share Posted July 28, 2007 I am new to php programming and i am having a problem in uploading a file to the server from my form can anybody help me in this context. I am sending the code that i have written along with the error message it is showing. <?php if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; } if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } ?> the error message is Warning: move_uploaded_file(upload/filenames.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\akuva\upload.php on line 32 PHP Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\TEMP\php28B.tmp' to 'upload/filenames.txt' in C:\Inetpub\wwwroot\akuva\upload.php on line 32 Quote Link to comment Share on other sites More sharing options...
Fadion Posted July 28, 2007 Share Posted July 28, 2007 Try to CHMOD 777 the directory where u are uploading, to give it full (including write) permissions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.