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

  • Thread starter Thread starter mano kumar
  • Start date Start date
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
 
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.
 
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
 
Back
Top