2011-10-06 27 views
-1
<form name="classupload" method="post" enctype="multipart/form-data" action=""> 
     <h3>Select pictures:&nbsp;</h3><br /> 
     <input type="file" name="Filedata[]" style="margin-top:2px;"/><br /> 
     <input type="file" name="Filedata[]" style="margin-top:2px;"/><br /> 

     <input type="file" name="Filedata[]" style="margin-top:2px;"/><br /> 
     <input type="file" name="Filedata[]" style="margin-top:2px;"/><br /> 
     <input type="file" name="Filedata[]" style="margin-top:2px;"/><br /> 
     <div id="viac"></div> 
     <div style="margin-top:4px;"><a onclick="multiupload();">More</a><br /></div> 
     <input type="submit" value="Upload" id="classupload"/> 
     </form> 

如何阅读这种形式的PHP室内用郎, 十分感谢PHP读取数组形式上传文件

回答

0
$destDir = '/mydir/'; // Where we will put the files 

for ($i = 0; $i < 5; $i++) { 
    if (!$_FILES['Filedata']['error'][$i]) { // only process files that are present and were uploaded successfully 
    move_uploaded_file($_FILES['Filedata']['tmp_name'][$i],$destDir.$_FILES['Filedata']['tmp_name'][$i]); 
    } 
} 

,文件现在已经在$destDir