Jump to content

Image file upload filtering


oceans

Recommended Posts

switch($_FILES["file"]["type"])

{

case 'image/gif':

  // gif stuff.

  break;

case 'image/jpg':

case 'image/jpeg':

  // jpg stuff':

  break;

case 'image/png':

  // png stuff.

  break;

case 'application/pdf':

  // pdf stuff.

  break;

}

 

and so on......

Friends,

 

I mislead again,

 

What I ment was, are there two types of jpag files?

 

Which is more common?

 

Adding to that will my server get infected with virus, if the uploaded image files are infected, I think it will not, as I simply store it that is all. client loads, and the image is hyper linked and shown on my website that is all.

 

What you think? Am I making sense?

Man i am sure you aren't making sense lol...

 

i quote my self

No difference in the file those are mime headers so you will know what kind of file this is...

 

There are diff headers for the same file type...

 

And there are no infected images... To be a virus it should be a kind of executable or sth like this..

 

But anyway i would limit the file size too for more security... you can find it here

$_FILES['name']['size']

 

Kathas

OK,

You took away my sweat on the virus thing!!!

 

OK, Thanks for your warm advice, i am using the size filter.

 

I tried the following:

 

try number 1

 

if ($_FILES["file"]["type"] == "image/jpg")

{

 

}

try number 2

 

if ($_FILES["file"]["type"] == "image/jpeg")

{

 

}

my file name="image.jpg"

 

any thing i made wrong

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.