I've been having difficulty getting .jpg files to upload. Sometimes the $FileType == "image/jpeg" works and sometimes it doesn't. In other words, sometimes if it is a .jpg image the second snippet below will register false.
I just changed to a new hosting. The other day the $FileType snippet said the image was of type "image/pjpeg". I don't know where it got the "p" in the "pjpeg." It was darned odd.
Stranger yet, the next day the $FileType snippet called the type "image/jpeg" - just the way it was supposed to.
Today, the whole thing is not working. It's got me stymied.
// Snippet to tell the type of file.
$FileType = $_FILES["UserFile"."$Image"]["type"];
// Snippet further down.
if ($FileType == "image/jpeg"){
$jpg = TRUE;
}else{
$jpg = FALSE;
}
The phpinfo() on the server has the settings "GIF Read Support" and "JPG Support". The server may be set so that it does not work too good with .jpg images.
I'm thinking about just having the script upload just .gif and .bmp images and forget about the .jpg images.
Is it something that I might be doing wrong or is it just that .jpg images sometimes just don't work too good?
Thanks.