php read Array Форма загрузки файла - PullRequest
0 голосов
/ 06 октября 2011
<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 lang, Большое спасибо

1 Ответ

0 голосов
/ 06 октября 2011
$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.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...