当上传的文件超过25MB时,如何显示警告? [英] how Display the caution When up lode more than 25MB File ?

查看:70
本文介绍了当上传的文件超过25MB时,如何显示警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



使用FileUploadControl选择超过25MB的文件而没有使用Activex控件选择多于25MB的文件时,如何显示警告.

Activex控件仅适用于IE,不适用于其他浏览器.

在热邮件中,当上传超过25MB的文件时,它会立即发出警告,就像我想要的一样.

在此先感谢.

谢谢&问候
SwaroopKumar P



How to display the caution when select more than 25MB file using FileUploadControl and with out using Activex control.

Activex control works only IE does not work other browsers.

In hot mail when upload more than 25MB file it display caution immediatly Jest like i want same.

Thanks in Advance.

Thanks & Regards
SwaroopKumar P

推荐答案

当您知道要上传的文件名时,可以使用以下内容:
When you know the file name to upload you can use something like:
System.IO.FileInfo file = new System.IO.FileInfo(fileName);
if (file.Length > 25*1024*1024) { ...


另外,最好将限制设置为可配置的,而不要像我在示例中那样在条件下使用常量.


Also, it''s a good idea to make the limit configurable, not to use constants in the condition as I have done in the example.


这篇关于当上传的文件超过25MB时,如何显示警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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