Re: Check that uploaded photo is a JPEG



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

.



Relevant Pages

  • Re: Important...Interesting...Danger behind some file types ??
    ... and .URL files I can´t understand what malicious code they can carry. ... case of the URL the maximum they could do is execute a local file via 'file:' ... this issue on some security forums but no one was able to reply. ... no good documentation the only things Microsoft provide on SCF files are IE ...
    (microsoft.public.security)
  • Re: More on why Javascript is evil
    ... displaying/executing them allows malicious code to execute and transfer ... information between 2 sites without you knowing about it. ...
    (comp.os.vms)
  • Re: Could not load type Namespace.Global - one mans solution
    ... share exposes another opening if someone wants to get malicious code ... to execute on the web server. ... >Here's what we did to resolve the Could not load type ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: terminating multiple try/catches
    ... why cant one simpley execute after the other, write the file first - if it ... succeeds then write to DB, if that fails delete file in catch. ... > I have a button click function that calls two different subs. ... > functions both being dependant on each other. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to disable the scroll bar
    ... Greg N. wrote: ... > Cookies have nothing to do with malicious code getting to execute on ... I personally think cookies are highly abused, ...
    (alt.html)

Loading