How to prevent the user uploading corrupted or damaged files?

M

muthu

Hi,
User will upload only picture and pdf files. I have return a asp.net
application for that,But thing is I need to restrict the user
uploading corrupted or damaged files.
Can anyone have any idea?
 
M

Michael Nemtsev

Hello muthu,

You need to intro either the ActiveX control which will validated the file
format (google for "image validator") or do it on server side.
But I don't think that it's very easy task.


---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

m> Hi,
m> User will upload only picture and pdf files. I have return a asp.net
m> application for that,But thing is I need to restrict the user
m> uploading corrupted or damaged files.
m> Can anyone have any idea
 
G

Guest

AFAIK, no built-in way. One crude option is to take the image stream on the
server-side and try loading into an Image class (as in
System.Drawing.Image.FromStream(Request.Files[0].InputStream)) and see if it
throws ArgumentException. If it does, the uploaded file is not an image.

Not sure how to do for PDF files.
 
M

muthu

Thanks for your valuable reply,
I am looking for some otherway.
AFAIK, no built-in way. One crude option is to take the image stream on the
server-side and try loading into an Image class (as in
System.Drawing.Image.FromStream(Request.Files[0].InputStream)) and see if it
throws ArgumentException. If it does, the uploaded file is not an image.

Not sure how to do for PDF files.



muthu said:
Hi,
User will upload only picture and pdf files. I have return a asp.net
application for that,But thing is I need to restrict the user
uploading corrupted or damaged files.
Can anyone have any idea?- Hide quoted text -

- Show quoted text -
 
B

bruce barker

most anti-virus vendors sell a toolkit with an api you can use to do this.

-- bruce (sqlwork.com)
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top