Heero Posted August 2, 2006 Share Posted August 2, 2006 Hello all,I am running this code on my [url=http://202.71.227.137/rehab/CMS/cmsadmin/move_uploaded_file.php]server[/url]:[CODE]<?phpinclude("phpincludes/userSessionCheck.php");if (!isset($_REQUEST["seenform"])) {?> <form enctype="multipart/form-data" action="move_uploaded_file.php" method="post"> Upload file: <input name="userfile" type="file"> <input type="submit" value="Upload"> <input type="hidden" name="seenform"> </form><?php} else { $uploaded_dir = "/upload/"; $filename = $_FILES["userfile"]["name"]; $path = $uploaded_dir . $filename; print "Temporary name: " . $_FILES['userfile']['tmp_name'] . "<br>"; print "Original name: $filename<br>"; print "Destination: $path<br>"; if (move_uploaded_file($_FILES["userfile"]["tmp_name"], $path)) { print "Uploaded file moved"; // do something with the file here } else { print "Move failed"; }}?>[/CODE]But I keep getting an move error. [QUOTE]Temporary name: /tmp/phpx6PnbEOriginal name: book_32.psdDestination: /upload/book_32.psdMove failed[/QUOTE]What can possible be creating this problem? Link to comment https://forums.phpfreaks.com/topic/16300-php-move_uploaded-file-error/ Share on other sites More sharing options...
BillyBoB Posted August 2, 2006 Share Posted August 2, 2006 do u have the folder that u want to move it too set to 777 if not u need to CHMOD that folder to 777 Link to comment https://forums.phpfreaks.com/topic/16300-php-move_uploaded-file-error/#findComment-67666 Share on other sites More sharing options...
Heero Posted August 2, 2006 Author Share Posted August 2, 2006 COol that fixed the problem. But isn't it dangerous to set it to complete modification for the folder (ie. 777)? Link to comment https://forums.phpfreaks.com/topic/16300-php-move_uploaded-file-error/#findComment-67677 Share on other sites More sharing options...
BillyBoB Posted August 2, 2006 Share Posted August 2, 2006 um somtimes but not if your just setting it to one folder that doesnt have anything in it Link to comment https://forums.phpfreaks.com/topic/16300-php-move_uploaded-file-error/#findComment-67679 Share on other sites More sharing options...
Heero Posted August 3, 2006 Author Share Posted August 3, 2006 Oh okay...just curious...why would I even set a folder to full permissions if I won't anything in it? Link to comment https://forums.phpfreaks.com/topic/16300-php-move_uploaded-file-error/#findComment-68236 Share on other sites More sharing options...
legohead6 Posted August 3, 2006 Share Posted August 3, 2006 thats why uploads should always go in thier own folder(or series of folders) and NEVER in ur main directory! Link to comment https://forums.phpfreaks.com/topic/16300-php-move_uploaded-file-error/#findComment-68332 Share on other sites More sharing options...
redarrow Posted August 3, 2006 Share Posted August 3, 2006 be also carefull the correct form format is as follows.notice the upper case letters and words .<!-- The data encoding type, enctype, MUST be specified as below --><form enctype="multipart/form-data" action="__URL__" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> <!-- Name of input element determines name in $_FILES array --> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /></form> Link to comment https://forums.phpfreaks.com/topic/16300-php-move_uploaded-file-error/#findComment-68333 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.