用于检查fileupload大小的javascript [英] javascript for checking the size of fileupload

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

问题描述

我想要一个客户端脚本(javascrpt)来检查asp.net中文件上传控件的文件上传大小(上传前)..

可以为此提供任何帮助... 。

I want a client side script(javascrpt) for checking the size of file uploading for file upload control in asp.net(before uploading)..
can any one help for this....

推荐答案

将此添加到您的web.config

Add this to your web.config
<configuration>
  <system.web>
    <httpruntime maxrequestlength="sizeinKB" />
  </system.web>
</configuration>



将sizeinKB替换为数值。它必须是KB。默认值为4096(4MB)


Replace sizeinKB with numeric value. It has to be in KB. Default is 4096(4MB)


由于JavaScript在客户端运行,因此无法访问本地文件系统。由于安全功能,您无法在用户的计算机上读取或写入文件,以防止网站在您的计算机上执行任何他们喜欢的操作。例如,在您的计算机上编写文件或病毒,简而言之,您无法使用JavaScript计算文件大小。
As JavaScript runs on client-side, it cannot access the local file system. You can''t read or write files on the user’s computer because of security feature to prevent sites doing anything they like on your computer. For example writing files or viruses on your computer, So in short you can not calculate the file size using JavaScript.


不可能。如果javascript可以访问文件系统,那么网络将是如此不安全,没有人会使用它。
Impossible. If javascript could access the file system, the web would be so insecure, no-one would use it.


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

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