开发者

php read Array form upload file

开发者 https://www.devze.com 2023-04-11 09:19 出处:网络
<form name=\"classupload\" method=\"post\"enctype=\"multipart/form-data\" action=\"\"> <h3>Select pictures:&nbsp;</h3><br />
<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="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.

0

精彩评论

暂无评论...
验证码 换一张
取 消