I have a multiple file upload with php and I want to create insert a mysql row for each file uploaded. so for example if 3 files were uploaded: a.txt, b.txt and c.txt, it would create 3 insert querys one where $filename was a.txt the second b.txt and the third 3.txt. is this possible?
$target = "test/";
if($target[strlen($target)-1]!='/')
$target=$target.'/';
$count=0;
foreach ($_FILES['uploaded']['name'] as $filename)
{
$temp=$target;
$tmp=$_FILES['uploaded']['tmp_name'][$count];
$count=$count + 1;
$temp=$temp.basename($filename);
move_uploaded_file($tmp,$temp);
$temp='';
$tmp='';
}
//for each file uploaded mysql_query("INSERT INTO files VALUES('','$date','$filename')");
For sure it’s possible. Just add your mysql_query at the end of your foreach block.