Sometimes, for some users, when trying to upload a .png file, I get an error that says something towards the effect of 'files must be .jpg or .png', yet the file is a .png file, with a .png extension.

I'm sorry I don't have more details, but this happened while I was showing a client the system, so I couldn't take screenshots or notes at the time. I converted the file to a .jpg, and it uploaded fine. Any ideas why this may be happening?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hutch’s picture

When the browser sends an image up to the server it includes some metadata, in this case it should have sent type='image/png'
Apparently it sent something else, eg type='image/jpg' ;-(
Sometimes you get people who think that you can change an image's type by changing it's name, you reversed the process and it worked. Or something like that.

Jaypan’s picture

In this case, I created the image myself in photoshop, and saved it as a .png file. It was then moved to a memory stick, and on to another computer, from where the upload was attempted. But there were no filetype or name conversions between that point, just media transfers.

If it happens again, I will upload the image here when it happens.

Steven Jones’s picture

I can confirm this issue with IE, and image picker 1.4.

Steven Jones’s picture

IE 8 sends:
'image/x-png'

Steven Jones’s picture

Version: 6.x-1.5 » 6.x-2.x-dev
Priority: Normal » Critical
Status: Active » Needs review
FileSize
1.69 KB
1.66 KB
1.5 KB

Okay the issue is that IE7 and later does the whole funny mime type thing with JPGs and PNGs. Imagepicker handles JPGs but not the PNG issue. Find attached patches for:

CVS Branch Release File
DRUPAL-6--2 6.x-2.x imagepicker-571198-6--2.patch
HEAD 6.x-1.x imagepicker-571198-HEAD.patch
DRUPAL-5--2 5.x-2.x imagepicker-571198-5--2.patch

Marking critical as this issue is quite serious.

hutch’s picture

Thank you for the patches, I will apply them to cvs shortly
M$Windows does it again ;-(

hutch’s picture

png-x bug applied to imagepicker, there are new stable versions for D5 and D6 and the devs will catch up later.

hutch’s picture

Priority: Critical » Normal
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.