Hi there -
If I'm understanding you correctly, your form is working where uploading your file and saving it somewhere on your server is concerned. Also everything you want to save to your database is getting saved there. The problem is that the name of your file is not being saved to the database. Do I have this right?
If so, maybe this code will help you with saving the file's label to your database:
if ($file) { //
copy ($file, "/path/to/your/server/directory/$file_name");
$filename = $file_name;
unlink ($file);
}
This little bit of script is a quick bit of code that handles moving a file to the server. The $filename variable takes on the name of the just uploaded file.
Now, when you do your table INSERT or UPDATE, just make sure you include $filename along with the rest of your data.
So to INSERT a new record:
$sql = "INSERT INTO your_table (id,text,filename) VALUES (NULL,'$text','$filename')";
mysql_query($sql);
And to UPDATE an existing record:
$sql = "UPDATE your_table SET text='$text', filename='$filename' WHERE id = '$id';
mysql_query($sql);