I'm making a form for admins on my site to submit new videos. the form page has several text boxes (for info like name of video, description, ect.) and a few file upload boxes (for flv video format, mp4 format, ect.)

But when it passes to the next page, when phgp tries to pick up the $_POST data from the form, it's all comming up empty. Take a look:

HTML form:

<form name="vid_form" method="post" enctype="multipart/form-data" action="http://www.mysite.com/videos/vid_manager.php"><br>
Video title: <input type="text" size="20" maxlength="25" name="form_title"><br>
Description: <TEXTAREA name="form_desc" cols=30 rows=4 maxlength="190"></TEXTAREA><br>
Target path:  <input type="text" size="15" maxlength="15" name="form_target"> (Expample "desired_dictionary/")<br>
Flv file: <input name="flv_file" type="file" /><br><br>
Mp4 file: <input name="mp4_file" type="file" /><br><br>
Jpg screenshot: <input name="jpg_file" type="file" /><br><br>
<input type="submit" value="Upload Video!" />

PHP code:

$form_title = $_POST['form_title'];
$form_desc = $_POST['form_desc'];
$target_path = $_POST['form_target'];

//upload flv file
$target_path = $target_path . basename( $_FILES['flv_file']['name']); 

if(move_uploaded_file($_FILES['flv_file']['tmp_name'], $target_path)) {
    $err_check[1] = "SUCCESS";
} else{ $err_check[1] = "FAILED";  }


//upload mp4 file
$target_path2 = $target_path2 . basename( $_FILES['mp4_file']['name']); 

if(move_uploaded_file($_FILES['mp4_file']['tmp_name'], $target_path2)) {
    $err_check[2] = "SUCCESS";
} else{ $err_check[2] = "FAILED";  }

//upload jpg screenshot
$target_path3 = $target_path3 . basename( $_FILES['jpg_file']['name']); 

if(move_uploaded_file($_FILES['jpg_file']['tmp_name'], $target_path3)) {
    $err_check[3] = "SUCCESS";
} else{ $err_check[3] = "FAILED";  }

Does anyone have any ideas for why it's not passing the data? Thanks! I've been battling with this all afternoon.

use $_GET OR $_REQUEST in place of $_POST . because you submit form to another page.

Hi mybluehair,

your form values are being POSTed to vid_manager.php ok, as you can see if you place some echo statements on line 4.
What error are you getting?


Zagga

Check for other forms on page. The chances could be that previous forms are not closed properly

Ok, so I tried what raju said, and used $_GET and that seems to be carrying info over to vid_manager.php just fine, but the problem now is that the files arn't being processed. Here is the top of my new form:

<form name="vid_form" method="get" enctype="multipart/form-data" action="http://www.mysite.com/videos/vid_manager.php"><br>

And here is the code in vid_manager.php that tries to retrieve the files that were uploaded:

$target_path = $_GET['form_target'];
$target_path2 = $_GET['form_target'];
$target_path3 = $_GET['form_target'];

//upload flv file
$target_path = $target_path . basename( $_FILES['flv_file']['name']); 

if(move_uploaded_file($_FILES['flv_file']['tmp_name'], $target_path)) {
    $err_check[1] = "SUCCESS";
} else{ $err_check[1] = "FAILED";  }


//upload mp4 file
$target_path2 = $target_path2 . basename( $_FILES['mp4_file']['name']); 

if(move_uploaded_file($_FILES['mp4_file']['tmp_name'], $target_path2)) {
    $err_check[2] = "SUCCESS";
} else{ $err_check[2] = "FAILED";  }

//upload jpg screenshot
$target_path3 = $target_path3 . basename( $_FILES['jpg_file']['name']); 

if(move_uploaded_file($_FILES['jpg_file']['tmp_name'], $target_path3)) {
    $err_check[3] = "SUCCESS";
} else{ $err_check[3] = "FAILED";  }

Now, all of my $err_checks are comming up "failed". Im not sure whats wrong. Any ideas?