graham23s Posted November 4, 2007 Share Posted November 4, 2007 Hi Guys, i can't seem to figure this out, i get the message upload successful but the file hasn't moved, any ideas on what could be wrong? if($_POST['submit']) { $filesize = $_FILES['usersphoto']['size']; $filename = $_FILES['usersphoto']['tmp_name']; ## vars $maxheight = 500; $maxwidth = 500; if($filesize == 0) { stderr("Upload Failed","No file was uploaded."); include("includes/footer.php"); exit; } $imagedimensions = getimagesize($filename); $width = $imagedimensions[0]; $height = $imagedimensions[1]; if($width > $maxwidth || $maxheight > 500) { stderr("Upload Failed","Images cannot be larger than $maxwidth x $maxheight, yours was ($width) width and ($height) height, please try again."); include("includes/footer.php"); exit; } $uploaddirectory = 'uploads'; ## Move uploaded file if(move_uploaded_file($_FILES['usersphoto']['tmp_name'], $uploaddirectory)) { stderr("Upload Successful","Upload went well."); include("includes/footer.php"); exit; } thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/76005-upload-successful-but-file-not-moving/ Share on other sites More sharing options...
The Little Guy Posted November 5, 2007 Share Posted November 5, 2007 I think that this is incorrect.... I think you need to change uploads. $uploaddirectory = 'uploads'; Try this: $uploaddirectory = 'uploads/'.$_FILES['usersphoto']['name']; Link to comment https://forums.phpfreaks.com/topic/76005-upload-successful-but-file-not-moving/#findComment-384771 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.