Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/163497-upload-two-files-at-once/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.