Here is the issue: The file name is not being saved into the database. Files are being uploaded to the server just fine, yet the file name will not save at all. I can echo the file name once the file is uploaded successfully but it does want to save the filename to the database for whatever reason. I'm sure this is an easy fix and I'm just missing something (I hope).
Thanks in advance.
(p.s. yes, I know I should be using mysqli)
HTML:
<form action="" name="loa" method="post" enctype="multipart/form-data">
<input type="hidden" name="size" value="350000">
<input type="file" name="loa">
<input type="submit" name="loasub" value="Upload Letter of Authorization">
</form>
PHP:
<?php
if (!empty($_POST['loasub'])) {
$target = "loa/";
$target = $target . basename( $_FILES['loa']['name']);
$theloa = ($_FILES['loa']['name']);
mysql_connect("localhost", "user", "pass") or die(mysql_error()) ;
mysql_select_db("mydb") or die(mysql_error()) ;
//Writes the information to the database
mysql_query("UPDATE customers SET loa='$theloa' WHERE id='30'") ;
if(move_uploaded_file($_FILES['loa']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
echo $theloa;
}
else {
echo "Sorry, there was a problem uploading your file.";
}
}
?>