PDA

View Full Version : Upload File



Medyman
10-06-2007, 05:18 PM
Hi guys...

I'm developing a backend and I need to upload 2 images at the same time.

I got it to work with only one image upload. But I can't figure out how to do this with 2 input file type fields at the same time.

Here is what I'm working with:


$fimage=$_FILES['fimage']['name'];
$fthumb=$_FILES['fthumb']['name'];

//upload file
$target_path = "upload/";

$target_path = $target_path . basename( $_FILES['fimage']['name']);

if(move_uploaded_file($_FILES['fimage']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['fimage']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
//end upload file

djr33
10-06-2007, 06:16 PM
Just use the code twice and change it to reflect the second field name and destination filename.

Medyman
10-07-2007, 12:09 AM
Thanks