Warning: include_once(/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/top_msg.php): failed to open stream: No such file or directory in /home/users/2/moriya-h5/web/confrage/php/forward/upload_comp/upload_comp.php on line 22
Warning: include_once(): Failed opening '/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/top_msg.php' for inclusion (include_path='.:/usr/local/php/7.4/lib/php') in /home/users/2/moriya-h5/web/confrage/php/forward/upload_comp/upload_comp.php on line 22
目次 |
---|
・ファイルアップロード(複数) ・サンプルコード ・サンプル |
(php部) <?php // 実行ボタンが押された時 if (isset($_POST[btnExec])) { //3回アップロードを行うので、処理の分だけループする。 for ($i = 0; $i < 3; $i++) { // ファイルの転送先を設定します。 // ファイルパス(絶対パス、ファイル名まで含む)を指定します。 // また、転送先はパーミッションの書き込み権限を許可してください。 $movetofile = "fullpath/" . $_FILES[uploadfile][name][$i]; // テンポラリファイルを正規の場所に移動します。 move_uploaded_file( $_FILES[uploadfile][tmp_name][$i], $movetofile ); } } ?>
(html部) <form method="post" enctype="multipart/form-data"> <input type="file" name="uploadfile[]" size="75"> <input type="file" name="uploadfile[]" size="75"> <input type="file" name="uploadfile[]" size="75"> <input type="submit" name="btnExec" value="実行"> </form>