I have multiple file upload form and I get files name with php loop;
for( $i=0 ; $i < $total ; $i++ ) {
$target_file = $target_dir . basename($_FILES["upload"]["name"][$i]);
if (move_uploaded_file($_FILES["upload"]["tmp_name"][$i], $target_file)) {
echo "The file ". basename( $_FILES["upload"]["name"][$i]). " has been uploaded.";}
}
When the loop finishes, I want to create a string with combining uploaded files name and I will store on my database as a string;
I assume 3 files uploaded
$_FILES["upload"]["name"][0], $_FILES["upload"]["name"][1], $_FILES["upload"]["name"][2]
image1.jpeg,image2.jpeg,image3.jpeg
$string.=$_FILES["upload"]["name"][$i].',';in the loop