Click here to Skip to main content
15,920,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

in file upload control , how to attach all formats word,pdf,txt,xls in asp.net
Posted

In file upload control, by default all the formats are allowed and you can upload anything.

In case you want to limit or be specific to allow only certain extensions then look here:
Controlling Uploaded File Types[^]
Client-Side Validation of File Types Permissible to Upload[^]
 
Share this answer
 
Comments
Albin Abel 17-Mar-11 3:02am    
Hmm. I haven't refreshed before posting my answer. My 5
kumar2233 17-Mar-11 3:11am    
hi, this code is suitable for all attach .doc,.txt...
Sandeep Mewara 17-Mar-11 3:36am    
I am still sure of what you mean. :doh:
Sandeep Mewara 17-Mar-11 3:36am    
I gave you all what could be possible for your question.
Espen Harlinn 17-Mar-11 3:45am    
Nice links, 5ed!
File upload control doesn't have restriction for any file type. You can check the file type after uploaded or you can check the file extension using a javascript. But the later may not work in some browsers. Simple reason how a control can identify file type, though it may tell you the extension, extension doesn't make sure the file is that type. How about changing .xls to .doc and upload. So once the file is read i.e posted, you can get the file type for known types.

As long as the fileupload is a input file type in html, it has no logic to read a file before posting. So better verify the file type after posted.
 
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