bfadler Posted July 18, 2008 Share Posted July 18, 2008 I get this error after clicking upload on my form, I've been searching and can't figure it out Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php1AAqJD' to 'directory/uploads/images/anyimage.jpg' in /directory/uploads/do_upload.php on line 10 heres the code; <?php $file_dir = "directory/uploads/images"; foreach($_FILES as $file_name => $file_array) { echo "path: ".$file_array["tmp_name"]."<br/>\n"; echo "name: ".$file_array["name"]."<br/>\n"; echo "type: ".$file_array["type"]."<br/>\n"; echo "size: ".$file_array["size"]."<br/>\n"; if (is_uploaded_file($file_array["tmp_name"])) { move_uploaded_file($file_array["tmp_name"], "$file_dir/".$file_array["name"]) or die ("Couldn't copy"); echo "file was moved!<br/>"; } } ?> Link to comment https://forums.phpfreaks.com/topic/115507-solved-error-moving-image/ Share on other sites More sharing options...
ratcateme Posted July 18, 2008 Share Posted July 18, 2008 it is trying to put the file in /directory/uploads/directory/uploads/images/ if you change $file_dir = "directory/uploads/images"; to $file_dir = "/directory/uploads/images"; it should work Scott. Link to comment https://forums.phpfreaks.com/topic/115507-solved-error-moving-image/#findComment-593851 Share on other sites More sharing options...
bfadler Posted July 18, 2008 Author Share Posted July 18, 2008 Thanks Scott I had to make the $file_dir = "/home/3645/public_html/test/uploads/images"; Link to comment https://forums.phpfreaks.com/topic/115507-solved-error-moving-image/#findComment-593876 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.