我正在尝试将上传的文件放入循环中以减少代码。
<input type="file" name="new1[]" accept="image/*">
<input type="file" name="new2[]" accept="audio/*">
<input type="file" name="new3[]" accept="text/*">
在 php 中有这些文件的循环
<?php
$all=array();
$all[]=array('new1','Dir_for_1st_type_to_store');
$all[]=array('new2','Dir for 2nd type');
$all[]=array('new3','Dir for 3rd type');
for($i=0;$i<count($all);$i++){
$newFile=$$all[$i][0]; //that is VAR in VAR trick
echo $newFile; //that's Ok. Temp files with paths displayed
echo $newFile_name[$i]; //that's not Ok. No output
....................//here is a HUUUUUUGE amount of code, written for 'one file variable'
}
?>
怎么了?