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

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

tutorial

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)
{
  //
}
if(contentType=="image/jpeg")
 {
   //code
 }

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, networking, learning, and sharing knowledge.