Hi
I have a File Upload script that allows 3 files at a time to be uploaded, and what I am trying to figure out is I need to save the filenames into a MySql Field so I can then link to them...
Here is My Code:
<?php
include('/home/sites/site5/global.php');
mkdir ("/home/sites/site5/web/uploads/$teachuser", 0755);
$file_dir = "/home/sites/site5/web/uploads/$teachuser";
$file_url = "http://www.mydomain.com/uploads/$teachuser";
foreach( $_FILES as $file_name => $file_array ) {
print "path: ".$file_array['tmp_name']."<br>\n";
print "name: ".$file_array['name']."<br>\n";
print "type: ".$file_array['type']."<br>\n";
print "size: ".$file_array['size']."<br>\n";
move_uploaded_file( $file_array['tmp_name'], $file_dir.'/'.$file_array['name'] )
or die ("Couldn't Copy");
$query = "INSERT INTO teachers (date, status, teachuser, teachpass, name, subject, details, attachname1, attachname2, attachname3, uploads1, uploads2, uploads3) VALUES ('$now', 'Pending', '$teachuser', '$teachpass', '$name', '$subject', '$details', '$attachname1', '$attachname2', '$attachname3', '$uploads1', '$uploads2', '$uploads3') ";
$result = mysql_query($query);
}
?>
Everything Works except I need to Insert the individual file names (Of the files which have been uploaded) into the uploads1, uploads2, uploads3 Fields of my Table.
So if File 1 name = thisfile.txt and file2 name = thisfile2.txt It saves thisfile.txt to uploads1 field and thisfile2.txt to uploads2 field , etc, etc...
Currently it is inserting the Temp Path Like: /tmp/php6OkJaC
I am pretty new at PHP Any Help is really appreciated.