how to restrict size and restrict format of fileupload control in
how its possible....??

Recommended Answers

All 4 Replies

here is a tutorial that restrict file type and length! :)


commented: very good, short and correct responses... +4

You have to use FileUpload.PostedFile properties.

int fileLen = FileUpload1.PostedFile.ContentLength;
string contentType=FileUpload1.PostedFile.ContentType;
if(fileLen>=1 && fileLen<=1024*1024)

thanks alot i got it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.