hi again,
how can i get the filename from a "input type file" which is passed as an array to the result page
for ($i=0; $i<$Files; $i++){
?>
<p>
<input type="file" name="picture[<?=$i?>]">
Name
<input type="text" name="filename[<?=$i?>]">
</p>
<?
}
when placing a <input type="file" name="picture"> outside the loop then i can get with $filename = picture_name; the name from the filepath (like document.pdf or file.txt)
on the result page i save then filename(user defined filename) and file (should be $filename = picture_name) and move the file to the server. i wanna do it by this way because it's easier for update and unlink files if in collumn file is stored only the filename.
by this code picture_name is stored as Array in table.
i would be very apprecheated for help
foreach ($filename as $key => $val) {
//$file = $picture[$key]; by this way the whole path is stored
if($val !="") {
$return = mysql_query("INSERT INTO files (ID,filename,file) VALUES('$currID','$val','$picture_name')", $link);
if ($return == false) {
Error("Die Dateien konnten nicht übertragen werden.<br>".mysql_error());
}
// picture:
if (($picture != "none") and ($err == false)) {
// move picture
if (!copy($picture, "images/$picture_name")) {
Error("Datei konnte nicht kopiert werden.");
}
}
}
}
}
greets,
chris