• <tfoot id='RyWr1'></tfoot>

    <i id='RyWr1'><tr id='RyWr1'><dt id='RyWr1'><q id='RyWr1'><span id='RyWr1'><b id='RyWr1'><form id='RyWr1'><ins id='RyWr1'></ins><ul id='RyWr1'></ul><sub id='RyWr1'></sub></form><legend id='RyWr1'></legend><bdo id='RyWr1'><pre id='RyWr1'><center id='RyWr1'></center></pre></bdo></b><th id='RyWr1'></th></span></q></dt></tr></i><div id='RyWr1'><tfoot id='RyWr1'></tfoot><dl id='RyWr1'><fieldset id='RyWr1'></fieldset></dl></div>

    • <bdo id='RyWr1'></bdo><ul id='RyWr1'></ul>

        <small id='RyWr1'></small><noframes id='RyWr1'>

        <legend id='RyWr1'><style id='RyWr1'><dir id='RyWr1'><q id='RyWr1'></q></dir></style></legend>

        如何使用 HTTP POST 使用 HTML 和 PHP 选择和上传多个文件?

        How can I select and upload multiple files with HTML and PHP, using HTTP POST?(如何使用 HTTP POST 使用 HTML 和 PHP 选择和上传多个文件?)
        <legend id='kBLFP'><style id='kBLFP'><dir id='kBLFP'><q id='kBLFP'></q></dir></style></legend>
            <tbody id='kBLFP'></tbody>
            <bdo id='kBLFP'></bdo><ul id='kBLFP'></ul>

              <small id='kBLFP'></small><noframes id='kBLFP'>

              • <i id='kBLFP'><tr id='kBLFP'><dt id='kBLFP'><q id='kBLFP'><span id='kBLFP'><b id='kBLFP'><form id='kBLFP'><ins id='kBLFP'></ins><ul id='kBLFP'></ul><sub id='kBLFP'></sub></form><legend id='kBLFP'></legend><bdo id='kBLFP'><pre id='kBLFP'><center id='kBLFP'></center></pre></bdo></b><th id='kBLFP'></th></span></q></dt></tr></i><div id='kBLFP'><tfoot id='kBLFP'></tfoot><dl id='kBLFP'><fieldset id='kBLFP'></fieldset></dl></div>

              • <tfoot id='kBLFP'></tfoot>
                  本文介绍了如何使用 HTTP POST 使用 HTML 和 PHP 选择和上传多个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有使用 <input type="file"> 上传单个文件的经验.但是,我无法一次上传多个文件.

                  例如,我想选择一系列图像,然后一次性将它们上传到服务器.

                  如果可能,最好使用单个文件输入控件.

                  有谁知道如何做到这一点?

                  解决方案

                  这在 PHP 中的文件上传.

                  I have experience doing this with single file uploads using <input type="file">. However, I am having trouble doing uploading more than one at a time.

                  For example, I'd like to select a series of images and then upload them to the server, all at once.

                  It would be great to use a single file input control, if possible.

                  Does anyone know how to accomplish this?

                  解决方案

                  This is possible in HTML5. Example (PHP 5.4):

                  <!doctype html>
                  <html>
                      <head>
                          <title>Test</title>
                      </head>
                      <body>
                          <form method="post" enctype="multipart/form-data">
                              <input type="file" name="my_file[]" multiple>
                              <input type="submit" value="Upload">
                          </form>
                          <?php
                              if (isset($_FILES['my_file'])) {
                                  $myFile = $_FILES['my_file'];
                                  $fileCount = count($myFile["name"]);
                  
                                  for ($i = 0; $i < $fileCount; $i++) {
                                      ?>
                                          <p>File #<?= $i+1 ?>:</p>
                                          <p>
                                              Name: <?= $myFile["name"][$i] ?><br>
                                              Temporary file: <?= $myFile["tmp_name"][$i] ?><br>
                                              Type: <?= $myFile["type"][$i] ?><br>
                                              Size: <?= $myFile["size"][$i] ?><br>
                                              Error: <?= $myFile["error"][$i] ?><br>
                                          </p>
                                      <?php
                                  }
                              }
                          ?>
                      </body>
                  </html>
                  

                  Here's what it looks like in Chrome after selecting 2 items in the file dialog:

                  And here's what it looks like after clicking the "Upload" button.

                  This is just a sketch of a fully working answer. See PHP Manual: Handling file uploads for more information on proper, secure handling of file uploads in PHP.

                  这篇关于如何使用 HTTP POST 使用 HTML 和 PHP 选择和上传多个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='nBZjg'></tbody>
                      • <bdo id='nBZjg'></bdo><ul id='nBZjg'></ul>
                      • <tfoot id='nBZjg'></tfoot>

                          1. <small id='nBZjg'></small><noframes id='nBZjg'>

                          2. <i id='nBZjg'><tr id='nBZjg'><dt id='nBZjg'><q id='nBZjg'><span id='nBZjg'><b id='nBZjg'><form id='nBZjg'><ins id='nBZjg'></ins><ul id='nBZjg'></ul><sub id='nBZjg'></sub></form><legend id='nBZjg'></legend><bdo id='nBZjg'><pre id='nBZjg'><center id='nBZjg'></center></pre></bdo></b><th id='nBZjg'></th></span></q></dt></tr></i><div id='nBZjg'><tfoot id='nBZjg'></tfoot><dl id='nBZjg'><fieldset id='nBZjg'></fieldset></dl></div>

                            <legend id='nBZjg'><style id='nBZjg'><dir id='nBZjg'><q id='nBZjg'></q></dir></style></legend>