Hi, I am using file upload control in .net. But I want , the user only able to upload doc, docx and pdf file.How do I make it possible?

Mark this thread as Solved if your question is answered.

Hi, I am using file upload control in .net. But I want , the user only able to upload doc, docx and pdf file.How do I make it possible?

string strExtension = Path.GetExtension(this.FileUpload1.FileName)

if (strExtension != ".doc" && strExtension != ".docx")

{  // prompt your warning message to client }

else

{  // upload the file if validation pass }
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.