I currently have one file upload working but I need two on one page. I have replicated the following code twice but this means the first upload works but the second one throws the else error message.
How could I make this code acceptable for 2 uploads:
<?php
// Where the file is going to be placed
$target_path = "uploads/";
/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "". basename($_SESSION ['filename'] = $_FILES['uploadedfile']['name'])."" ;
}
else{
echo "There was an error uploading the file, please try again!";
}
?>