Hi all, I have a little problem when creating a doc management site. I was using a script off the web to upload a file using a web form. The action of the form was the new page which did the uploading say "upload.php". This file contained the following: -
<?php
// Where the file is going to be placed
$target_path = "uploads/";
/ Add the original filename to the 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 "The file ". basename( $FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
It was working great (using IIS) the file appeared in the upload folder. But then I thought about adding a search facility. When I changed the original page to update a MySQL database (using Dreamweaver) the forms action changed to <?php echo $editFormAction; ?>
I pointed the insert record dialogue at upoad.php so that still loads but it throws the default error. It doesn't upload the file but it does update the database.
How can I get it to do both?
Thanks, Mark