你是用implode
不explode
我不确定你HTML
的结构是怎样的,但你的名字应该是这样的
$_FILES['pf5']['name'][0];
$_FILES['pf5']['name'][1];
$_FILES['pf5']['name'][2];
原来它是这样的,这意味着您正在使用多种形式......
$photo_name1 = $_FILES['pf5']['name'];
$photo_name2 = $_FILES['pf2']['name'];
想象一下
$names = array (); //have name array
foreach ( $_FILES ['image'] ['tmp_name'] as $key => $val) {
$names [] = $_FILES ['image'] ['name'] [$key]; //put names to array
}
echo implode(",", $names); // print the names
HTML
<form method="post" enctype="multipart/form-data">
<label for="file">Filename 1:</label> <input type="file" name="image[]"
id="file" /> <br /> <label for="file">Filename 2:</label> <input
type="file" name="image[]" id="file" /> <br /> <label for="file">Filename
3:</label> <input type="file" name="image[]" id="file" /> <br /> <input
type="submit" name="submit" value="Submit" />
</form>