Re: Checking if an image
From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 04/19/04
- Next message: none: "test"
- Previous message: Steve Peterson: "Checking if an image"
- In reply to: Steve Peterson: "Checking if an image"
- Next in thread: Ed Astle: "Re: Checking if an image"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 20 Apr 2004 00:19:58 +0200
There is no such check that I know of.
You could attempy to open the image within a try-catch block. A bogus image
will almost certainly throw an exception that you can deal with
appropriately.
-- Bob Powell [MVP] Visual C#, System.Drawing All you ever wanted to know about ListView custom drawing is in Well Formed. http://www.bobpowell.net/currentissue.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/gdiplus_faq.htm Read my Blog at http://bobpowelldotnet.blogspot.com "Steve Peterson" <speterson@arrakis.es> wrote in message news:%23cNh71kJEHA.2244@tk2msftngp13.phx.gbl... > Hi > > I have an ASP.NET where users can upload images to the server. I've already > implemented business logic that checks the file extension of the files > uploaded to make sure they are of an acceptable image type. However, it > occured to me that a devious user might simply give some non image (Like an > .exe) file to an image extension, upload it, and then cause havoc latter > on. > > So, what I need to do is implement business logic that makes sure they file > uploaded IS an image file before saving to the server. I'm not familiar with > working with graphics, but I figure there must be some method in .NET that > returns a boolean value if the file is an image format or something along > those lines.. > > Can anyone help me out?? > > TIA > > Steve > >
- Next message: none: "test"
- Previous message: Steve Peterson: "Checking if an image"
- In reply to: Steve Peterson: "Checking if an image"
- Next in thread: Ed Astle: "Re: Checking if an image"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|