Posted by bill on 02/20/07 09:30
bill wrote:
> Can anyone help. I am using the following code to check that jpg image
> only can be uploaded
>
> if ($_FILES['userfile']['type'] != 'image/jpeg')
> {
> $msg = 'Problem: file is not jpg';
> }
>
> when uploading a jpg or jpeg this works fine in firefox but when i try
> to upload a jpg using internet explorer an error is produced saying that
> it is not a jpg when in fact it is.
> Can anyone help
> Thanks
> bill
I have tried the array approach and it still says image is not a jpg.
I have a javascript that only allows jpg and this works ok and only
allows jpg to the server but the server still says its not a jpg. Here
is the code from the form.
<form enctype="multipart/form-data" action="picture.php" name="frmpic"
method=post onsubmit="return ExtensionsOkay();">
<input type="hidden" name="MAX_FILE_SIZE" value="20000">
Upload image file: <input name="userfile" type="file">
<input type="submit" value="Send File" name="upload">
</form>
$img_types = array('image/jpeg','image_jpg');
if (!in_array($_FILES['userfile']['type'],$img_types))
{
$msg = 'Problem: file is not jpg';
}
How can it say that it is not a jpg when it is and works ok in firefox.
Navigation:
[Reply to this message]
|