crouchjay Posted June 7, 2006 Share Posted June 7, 2006 [code]$success=move_uploaded_file($_FILES["imgfile"]['tmp_name'], 'C:\Apache2\htdocs\GP2\imageEditing\\'.$_FILES["imgfile"]['name']);[/code]I have WINDOWS OS and all file directory names are correct. It returns false. Please helpThanks.Jay. Link to comment https://forums.phpfreaks.com/topic/11407-moving-an-uploaded-image/ Share on other sites More sharing options...
ober Posted June 7, 2006 Share Posted June 7, 2006 Try this:[code]$success=move_uploaded_file($_FILES["imgfile"]['tmp_name'], 'C:\\Apache2\\htdocs\\GP2\\imageEditing\\'.$_FILES["imgfile"]['name']);[/code] Link to comment https://forums.phpfreaks.com/topic/11407-moving-an-uploaded-image/#findComment-42792 Share on other sites More sharing options...
crouchjay Posted June 7, 2006 Author Share Posted June 7, 2006 Thanks, but unfortunately that didn't work. I also tried changing the slashes around but that didn't help either.[code]$image=new Image();$file=$_FILES["imgfile"]['type'];$ext=$image->verifyImage($file);if(strlen($ext)>4){echo $ext; exit();}//Display error message, needs to be finished$filename='temp_img'.$ext;$image->setFilename($path_username_temp.'\\'.$filename);$error=$image->uploadImage("imgfile", $path_username_temp, '\\'.$filename);$success=move_uploaded_file($_FILES["imgfile"]['tmp_name'], 'C:\Apache2\htdocs\GP2\imageEditing\\'.$_FILES["imgfile"]['name']);if($success==false) echo "false";else echo "true";[/code]This is what the code looks like around it. The rest works as intended.Jay Link to comment https://forums.phpfreaks.com/topic/11407-moving-an-uploaded-image/#findComment-42795 Share on other sites More sharing options...
ober Posted June 7, 2006 Share Posted June 7, 2006 Well, here's a snippet from one of my upload files... I'm running Win 2000 on IIS 5 (I WISH I had Apache):[code]$uploaddir = 'C:\\Inetpub\\wwwroot\\Durb\\upload\\'; if(substr(basename($_FILES['userfile']['name']),-4) != '.csv') { echo "<p class=\"warn\">Only CSV files will be accepted as input.</p><br/>"; $showform = 1; if(isset($_REQUEST['oil'])) $_REQUEST['uload'] = 1; } else { $tempfilename = substr(basename($_FILES['userfile']['name']),0,-4) . "-" . date("njYhis") . ".csv"; $uploadfile = $uploaddir . $tempfilename; echo "<p class=\"other\">Filename: " . $_FILES['userfile']['name'] . "</p>"; echo "<p class=\"other\">Temporary Filename: " . $tempfilename . "</p>"; echo "<p class=\"other\">File size: " . $_FILES['userfile']['size'] . "</p>"; echo "<p class=\"other\">File type: " . $_FILES['userfile']['type'] . "</p>"; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "<br/><p class=\"norm2\" style=\"color:green\">File is valid, and was successfully uploaded and relocated.</p><br/>";[/code] Link to comment https://forums.phpfreaks.com/topic/11407-moving-an-uploaded-image/#findComment-42796 Share on other sites More sharing options...
crouchjay Posted June 7, 2006 Author Share Posted June 7, 2006 Found the problem, I am stupid. I had already moved it, I needed rename(). Link to comment https://forums.phpfreaks.com/topic/11407-moving-an-uploaded-image/#findComment-42898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.