note 105754 added to function.move-uploaded-file

From: Date: Mon, 12 Sep 2011 15:54:40 +0000
Subject: note 105754 added to function.move-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-183114@lists.php.net to get a copy of this message
hi, i am trying to code a file uploader in php using IIS server this is the code of the form: <html><body> <form method="post" enctype="multipart/form-data" action="processform.php"> <input type="hidden" name="MAX_FILE_SIZE" value="200000"> <input type="file" name="thefile"><br/> <input type="submit" value="Submit File...."> </form> </body></html> this is the code of processform.php <?php $upload_dir = "C:/Inetpub/wwwroot/cbt/upload/"; $upload_file = $upload_dir . basename($_FILES['thefile']['name']); if(copy($_FILES['thefile']['tmp_name'],$upload_file)){ echo "File copy was Successful!"; } else { echo "Oops... something went wrong..."; print_r($_FILES); } ?> now the problem is each time i try to click on the submit button after browsing any file it shows the message : Warning: copy(C:/Inetpub/wwwroot/cbt/upload/1.jpeg) [function.copy]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\cbt\processform.php on line 8 Oops... something went wrong...Array ( [thefile] => Array ( [name] => 1.jpeg [type] => image/jpeg [tmp_name] => C:\temps\php67.tmp [error] => 0 [size] => 59592 ) ) help me guys...... wats the problem with the code ? ---- Server IP: 69.147.83.197 Probable Submitter: 117.196.183.63 ---- Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php Edit -- https://master.php.net/note/edit/105754 Del: integrated -- https://master.php.net/note/delete/105754/integrated Del: useless -- https://master.php.net/note/delete/105754/useless Del: bad code -- https://master.php.net/note/delete/105754/bad+code Del: spam -- https://master.php.net/note/delete/105754/spam Del: non-english -- https://master.php.net/note/delete/105754/non-english Del: in docs -- https://master.php.net/note/delete/105754/in+docs Del: other reasons-- https://master.php.net/note/delete/105754 Reject -- https://master.php.net/note/reject/105754 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#183114) next »