how to allow user to upload only doc. file...

M

mano kumar

hello, is there a way i can control what user upload to
the webserver? i've created a upload feature and i dont
know howto control what the user uploads. i want to allow
my user to only upload .doc files. any help i greatly
appriciated...


yours truly

Mano Kumar
 
S

Steve C. Orr [MVP, MCSD]

You can pretty much only truly enforce this once the file has been uploaded.
Then you can get the content type of the file from your file upload control,
something like this:
File1.PostedFile.ContentType

If the ContentType isn't what you expected then you can simply ignore the
file (by not saving it anywhere) and display an appropriate message to your
user.
 
J

Jerry III

You may even add check the contents of the file (all DOC files have more or
less the same structure). But Steve's right, you have to wait for the user
to upload the file. On the other hand, you don't even have to save it to a
disk if you reject it.

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top