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

    3. <legend id='qK9za'><style id='qK9za'><dir id='qK9za'><q id='qK9za'></q></dir></style></legend>
    4. 我如何知道使用 PHP 上传的文件数量?

      How can I know a number of uploaded files with PHP?(我如何知道使用 PHP 上传的文件数量?)

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

          <legend id='VvsWJ'><style id='VvsWJ'><dir id='VvsWJ'><q id='VvsWJ'></q></dir></style></legend>
          <tfoot id='VvsWJ'></tfoot>
          • <bdo id='VvsWJ'></bdo><ul id='VvsWJ'></ul>

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

                  <tbody id='VvsWJ'></tbody>
              1. 本文介绍了我如何知道使用 PHP 上传的文件数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个表格,里面有几个

                I have a form with several

                input type="file"
                

                标签.我如何在服务器端知道用户上传的文件数量.他可以上传3个文件,或者可能是5个文件,1个甚至什么都没有.我需要知道用户上传了多少文件.

                tags. How can I know on the server side amount of files uploaded by the user. He can upload 3 files, or may be 5 files, 1 or even nothing. I need to know how much files user have uploaded.

                推荐答案

                如果您输入的上传标签名称为 file1, file2

                If you are having input upload tags with name like file1, file2 then

                if($_FILES['file1']['size'] > 0)
                    echo "User uploaded some file for the input named file1"
                

                现在对于许多文件(查看您的输出),像这样运行 foreach 循环:-

                Now for many files (looking at the output you are having), run a foreach loop like this:-

                $cnt=0;
                foreach($_FILES as $eachFile)
                {
                     if($eachFile['size'] > 0)
                        $cnt++;
                }
                echo $cnt." files uploaded";
                

                我不确定为什么 我如何知道使用 PHP 上传的文件数量? 被否决了?对于'0'?

                I am not sure why the similar answer in How can I know a number of uploaded files with PHP? got downvoted? For the '0' ?

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

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

                相关文档推荐

                PHP Upload File Validation(PHP 上传文件验证)
                PHP Error - Uploading a file(PHP 错误 - 上传文件)
                How can I write tests for file upload in PHP?(如何在 PHP 中编写文件上传测试?)
                php resizing image on upload rotates the image when i don#39;t want it to(php在上传时调整图像大小会在我不想要它时旋转图像)
                How to send additional data using PLupload?(如何使用 PLupload 发送附加数据?)
                change button text in js/ajax after mp4 =gt;mp3 conversion in php(在 php 中的 mp4 =gt;mp3 转换后更改 js/ajax 中的按钮文本)

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

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

                  • <bdo id='Haa5P'></bdo><ul id='Haa5P'></ul>
                  • <legend id='Haa5P'><style id='Haa5P'><dir id='Haa5P'><q id='Haa5P'></q></dir></style></legend>

                            <tbody id='Haa5P'></tbody>
                        • <tfoot id='Haa5P'></tfoot>