php read Array form upload file
<form name="classupload" method="post" enctype="multipart/form-data" action="">
<h3>Select pictures: </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="mar开发者_如何学Pythongin-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>
How to read this form wiht php lang, Great Thanks
$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]);
}
}
The files are now in $destDir
.
精彩评论