用于HTML表单的MAX_FILE_SIZE [英] MAX_FILE_SIZE for HTML forms

查看:723
本文介绍了用于HTML表单的MAX_FILE_SIZE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试图在w3c网站上查找有关MAX_FILE_SIZE隐藏字段的信息,以限制文件上传的大小,但是找不到多少。在其他地方查找,但一般来说,找不到一条关于此的内容。我知道这在许多浏览器中都失败了,但我还是想了解它。以下是我对此的一些疑问


*是否有必要将其包含在表单的开头?

*它是否适用于包含单个表单多个文件上传字段?

*如果我在每个文件输入之前指定不同的MAX_FILE_SIZE字段(对于相同的表单),它会起作用吗?如果没有那么最终的MAX_FILE_SIZE值是多少?或者是否会出错?


谢谢


I tried to lookup on w3c website for information on the MAX_FILE_SIZE hidden field to restrict the size of file uploads, but couldn''t find much. Looked up elsewhere, but generally, couldn''t find more than a single line about this. I know that this fails in many browsers, but I''d still like to learn about it. Here are some of my doubts regarding this

* Is it necessary to include it at the beginning of the form?
* Does it work for single form containing multiple file upload fields?
* If I specify a different MAX_FILE_SIZE field before each of the file inputs (for the same form), would it work? If not then what would the final MAX_FILE_SIZE value be? or does that give an error?

thanks

推荐答案

从来没有听说过它,并且在html中没有这样的东西。
Never heard of it and there is no such thing in html.



从来没有听说过它,并且在html中没有这样的东西。
Never heard of it and there is no such thing in html.



建议我们在包含文件上传的表单中包含此内容。


< input type =" hidden"名称= QUOT; MAX_FILE_SIZE"值= QUOT; 512000" />


这限制了可以上传的文件的大小。我主要使用php,如果上传的文件超过此值,则会出错。它必须与其他脚本语言类似。

It is recommended that we include this inside forms containing file uploads.

<input type="hidden" name="MAX_FILE_SIZE" value="512000" />

This limits the size of file that can be uploaded. I mostly use php, and it gives an error if the uploaded file exceeds this value. It must be similar in other scripting languages.



这限制了可以上传的文件的大小。
This limits the size of file that can be uploaded.



它没有。 "名称"是您分配给input元素的名称,而不是其他名称。我用Google搜索,似乎它可能是PHP中用于此类事物的常用名称,但形式为''的动作。调用PHP脚本,我认为,该名称用于监视文件大小。在任何情况下,HTML和浏览器都不会对名称做任何事情,除非将其传输到表单内的服务器。

It does not. "name" is a name you assign to the input element and nothing else. I googled around and it seems it might be a common name used in PHP for such things but the form''s "action" calls a PHP script where, I assume, that name is used to monitor the file size. In any case, HTML and the browser does absolutely nothing with the name except transmit it to the server inside the form.


这篇关于用于HTML表单的MAX_FILE_SIZE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆