Re: Check that uploaded photo is a JPEG
- From: "Chris Mahoney" <chrismahoney@xxxxxxxxx>
- Date: 8 Feb 2007 12:22:17 -0800
On Feb 8, 3:23 pm, wizof...@xxxxxxxxxxx wrote:
I would think the obvious (if not necessarily most efficient) solution
is to use System.Drawing.Image.FromFile(...): you can then check the
RawFormat property, or trap for any exceptions for invalid files. I
don't believe FromFile() can cause malicious code to execute.
On Feb 8, 9:42 pm, "Alexey Smirnov" <alexey.smir...@xxxxxxxxx> wrote:
Then try to create a System.Drawing.Image object from a given source. If
this succeeds, you can be fairly certain the source is a valid image. In
addition, check Img.RawFormat
Thanks to both of you for your help. So far it's worked with every
weird and wonderful combination I've thrown at it :)
Chris
.
- References:
- Check that uploaded photo is a JPEG
- From: Chris Mahoney
- Re: Check that uploaded photo is a JPEG
- From: wizofaus
- Check that uploaded photo is a JPEG
- Prev by Date: Re: Prevent an image from overflowing table size
- Next by Date: Re: csharp syntax help
- Previous by thread: Re: Check that uploaded photo is a JPEG
- Next by thread: Re: Check that uploaded photo is a JPEG
- Index(es):
Relevant Pages
|
Loading