Bman900 Posted June 24, 2009 Share Posted June 24, 2009 here is my code: <?php $target_path = "videos/"; $imgtarget_path = "image/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $movielink = basename( $_FILES['uploadedfile']['name']); $imagelink = basename( $_FILES['imagefile']['name']); $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $imgtarget_path = $imgtarget_path . basename( $_FILES['imagefile']['name']); if((move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) || (move_uploaded_file($_FILES['imagefile']['tmp_name'], $imgtarget_path))) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; echo "The file ". basename( $_FILES['imagefile']['name']). " has been uploaded"; mysql_query("INSERT INTO video (title, descript, link, image) VALUES('$formtitle', '$descrip', '$movielink', '$imagelink') ") or die(mysql_error()); } else{ echo "There was an error uploading the file, please try again!"; } ?> The video file gets uploaded correctly but the image file doesn't go any where. It gives me the messages that they both have been uploaded fine which obviously is wrong. Any help is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/163497-upload-two-files-at-once/ Share on other sites More sharing options...
Adam Posted June 24, 2009 Share Posted June 24, 2009 In this line: if((move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) || (move_uploaded_file($_FILES['imagefile']['tmp_name'], $imgtarget_path))) { You're saying if "uploadedfile" OR "imagefile" are uploaded (...) That should be && (AND); although to be honest I wouldn't do it that way. Do you have errors enabled do you know? If there's no warning message that suggests the file you're trying to upload is not valid. Quote Link to comment https://forums.phpfreaks.com/topic/163497-upload-two-files-at-once/#findComment-862639 Share on other sites More sharing options...
Bman900 Posted June 24, 2009 Author Share Posted June 24, 2009 Once I did that I got this : http://shadowsofalcatraz.com/pandora/admin/image/default.jpeg as the image, the url itself. instead of the image. Quote Link to comment https://forums.phpfreaks.com/topic/163497-upload-two-files-at-once/#findComment-862659 Share on other sites More sharing options...
Adam Posted June 24, 2009 Share Posted June 24, 2009 Where did you get that, in the database? Quote Link to comment https://forums.phpfreaks.com/topic/163497-upload-two-files-at-once/#findComment-862668 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.