asp.net中的FileBrowse控件 [英] FileBrowse Control in asp.net

查看:70
本文介绍了asp.net中的FileBrowse控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果该文件的大小大于2 mb,如何通过asp.net中的filebrowse控件选择文件时如何停止上传
?????

how to stop the uploading when the file is selected with the help of filebrowse control in asp.net if the size of that file is greater den 2 mb
?????

推荐答案

签出FileContent属性.这将提供一个流,然后您可以检查其长度属性.
Check out FileContent property. That would give a stream and then you can check its length property.


这将为您提供帮助.
参考:
如何在asp:FileUpload中检查文件内容长度?
This will help you.
Refer:
How to check file content length in asp:FileUpload?


if(FileUpload1.FileContent .Length< = 1048576)
{
FileUpload1.SaveAs(Request.ServerVariables ["APPL_PHYSICAL_PATH"] +"/Images/" + FileUpload1.FileName);
}
其他
Label14.Text =文件大小很大";
-------------------------------------------------- --------------------
当我加载更大的文件大小为2mb的文件时,则与服务器的连接断开了.... !!!!
是否需要对ma代码进行任何更正...
if (FileUpload1.FileContent.Length <= 1048576)
{
FileUpload1.SaveAs(Request.ServerVariables["APPL_PHYSICAL_PATH"] + "/Images/" + FileUpload1.FileName);
}
else
Label14.Text="The File Size is to Big";
----------------------------------------------------------------------
when i load a file greater den da size of 2mb then connection with server is broken ....!!!!
is dere any correction in ma code...


这篇关于asp.net中的FileBrowse控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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