Hi
I am trying to upload a file so that it can be emailed and also send the file path to a database.
The code is like the following
With the above bit of code the file will upload but not send to the database.
Once I remove enctype="multipart/form-data", the information goes to the database but it will not upload the file.
Can anyone point me in the right direction as to how I would achieve both.
I am trying to upload a file so that it can be emailed and also send the file path to a database.
The code is like the following
Code:
<form enctype="multipart/form-data" name="test" method="POST" action="filename.php">
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
<div><input type="file" id="find_file" name="find_file" Size="80"></div>
</form>
.
.
.
<?php
*** code to send info to mysql database ***
.
.
.
//Code For File Upload
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['find_file']['name']);
if(move_uploaded_file($_FILES['find_file']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['find_file']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
With the above bit of code the file will upload but not send to the database.
Once I remove enctype="multipart/form-data", the information goes to the database but it will not upload the file.
Can anyone point me in the right direction as to how I would achieve both.