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

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

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

      <legend id='Apawf'><style id='Apawf'><dir id='Apawf'><q id='Apawf'></q></dir></style></legend>
      <i id='Apawf'><tr id='Apawf'><dt id='Apawf'><q id='Apawf'><span id='Apawf'><b id='Apawf'><form id='Apawf'><ins id='Apawf'></ins><ul id='Apawf'></ul><sub id='Apawf'></sub></form><legend id='Apawf'></legend><bdo id='Apawf'><pre id='Apawf'><center id='Apawf'></center></pre></bdo></b><th id='Apawf'></th></span></q></dt></tr></i><div id='Apawf'><tfoot id='Apawf'></tfoot><dl id='Apawf'><fieldset id='Apawf'></fieldset></dl></div>
      1. 统计和限制上传文件的数量(HTML文件输入)

        时间:2023-05-20

          • <tfoot id='SSQPn'></tfoot>
                • <bdo id='SSQPn'></bdo><ul id='SSQPn'></ul>

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

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

                  <legend id='SSQPn'><style id='SSQPn'><dir id='SSQPn'><q id='SSQPn'></q></dir></style></legend>
                    <tbody id='SSQPn'></tbody>
                  本文介绍了统计和限制上传文件的数量(HTML文件输入)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个基本的、众所周知的多文件上传表单.类似的东西...

                  I have that basic, well known multiple file upload form. Something like that...

                  <input type="file" multiple="multiple" name="something[]" />
                  

                  有没有办法(最好是硬编码选项)来限制用户可以选择的文件数量?我所说的限制是指严格阻止,而不仅仅是在数量超过时发出警告.

                  Is there a way (preferable a hard coded option) to limit the number of files that user can select? By limit i mean strictly blocked, not just a warning if number is exceeded.

                  提前致谢.:)

                  推荐答案

                  您可以实现一个 javascript 解决方案来检查已选择的文件数量,然后您可以使用它来禁止上传到服务器.不过,对于这个问题,实际上只有客户端解决方案,因为实际上没有什么可以阻止用户将这些文件发布到您的 php 脚本中.您可以指定最大上传大小限制,但它并不特定于正在上传的文件数量.

                  You can implement a javascript solution to check the number of files that have been selected, which you can then use to forbid uploading to the server. There are really only going to be client-side solutions to this problem though, as there is really nothing stopping a user from posting these files to your php script anyway. You can specify a maximum upload size limit, but it isn't specific to the number of files that are being uploaded.

                  您最好的办法是实施一些 javascript 检查,为您的 http 服务器(或在 PHP 中)指定一个合理的最大上传大小,然后忽略任何超过您的最大数量上传的文件.

                  Your best bet is to implement some javascript checking, specifying a reasonable maximum upload size for your http server (or in PHP), and then ignoring any file uploaded if it exceeds your maximum count.

                  在此处阅读 HTML5 文件 API 以限制所选文件的数量:http://dev.w3.org/2006/webapi/FileAPI/

                  Read about the HTML5 File API here to restrict the count of selected files: http://dev.w3.org/2006/webapi/FileAPI/

                  这里是 php.ini 文档,它解释了如何对上传进行大小限制:http://php.net/manual/en/ini.core.php

                  Here is the php.ini docs which explain how to make a size limitation on uploads: http://php.net/manual/en/ini.core.php

                  正如评论中所建议的,请查看:http://php.net/manual/en/ini.core.php#ini.max-file-uploads

                  As was suggested in the comments, check out: http://php.net/manual/en/ini.core.php#ini.max-file-uploads

                  这篇关于统计和限制上传文件的数量(HTML文件输入)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:$_FILES 字段 'tmp_name' 对 .JPG 文件扩展名没有 下一篇:PHP 文件上传:基于 MIME 或扩展名的验证?

                  相关文章

                  最新文章

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

                • <small id='5PYDF'></small><noframes id='5PYDF'>