Click here to Skip to main content
16,022,402 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
?????
Posted

 
Share this answer
 
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...
 
Share this answer
 
Check out FileContent property. That would give a stream and then you can check its length property.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900