Hi group,
I have following code for uploading a file in PHP:
$target = "/var/www/html/sa/usr_bg_imgs/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ext = $_FILES['uploaded']['type'];
However, $_FILES['uploaded']['type'] will not work for JPG files since
it returns nothing!
It works fine for other files. For example for gif files I do get:
image/gif as MIME and text/plain for text files but when I try
test.jpg it doesn't recognize the MIME type.
This is an issue since checking the physical file extension is not a
right way in terms of security. What should I do?
Is this a PHP bug?!
Thanks.
Comment