Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Validation control can be used to upload a file in file uploding control.so that no file more than 1MB can be uploaded
Posted
Comments
Tom Marvolo Riddle 28-Feb-14 0:19am    
I guess you want to restrict the size of the uploading file.am i right?
Member 10578683 28-Feb-14 1:30am    
yes
Tom Marvolo Riddle 28-Feb-14 1:32am    
solution posted.Try it

 
Share this answer
 
Please use this code
C#
int fileSize = FileUpload1.PostedFile.ContentLength;


if you want to limit max size as 1 mb then check
C#
if (fileSize <  1024)


Hope this may help you.
 
Share this answer
 
v2

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