1
Cifug
ExtGallery Upload Error jpeg mime type
  • 2013/8/12 0:40

  • Cifug

  • Quite a regular

  • Posts: 208

  • Since: 2007/12/13


Hi guys, I tried to upload a photo with the file extension ".jpeg" and I get the below error:

Error during upload Suspicious image upload refused


I don't get this error for .jpg or .gif

I'm thinking that maybe the .jpeg mime type is not allowed for some reason. Is there a setting somewhere where you can allow/disallow certain mime types?

My config is:
XOOPS Version - XOOPS 2.5.6
Extgallery - 1.11
PHP Version - 5.3.26
mySQL Version - 5.0.96-community

Cheers,
Marty

2
Mamba
Re: ExtGallery Upload Error jpeg mime type
  • 2013/8/12 12:54

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


1) In /admin/photo.php in line 99 change it from:

if(preg_match("/.*gif/",strtolower($f)) || preg_match("/.*jpg/",strtolower($f)) || preg_match("/.*png/",strtolower($f))) {


to:
if(preg_match("/.*gif/",strtolower($f)) || preg_match("/.*jpg/",strtolower($f)) || preg_match("/.*jpeg/",strtolower($f)) ||preg_match("/.*png/",strtolower($f))) {


Do the same for line 601 in the same file.

2) in file /public-download.php, around line 42, add this line:

case ".jpeg"$type "image/jpeg"; break;


Let us know if this worked for you.

In the future we'll need a standard "mime type manager", that could be used by all modules. There is just too much inconsistencies between modules how we handle files. The same we'll need for 'upload manager". What do you guys recommend that we use? Which modules does the best job with it?
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
Cifug
Re: ExtGallery Upload Error jpeg mime type
  • 2013/8/12 21:40

  • Cifug

  • Quite a regular

  • Posts: 208

  • Since: 2007/12/13


Hi Mamba, made the changes you suggested and still receiving the same error.

I tried updating module and cleared site cache and browser cache also

Cheers,
Marty

4
Mamba
Re: ExtGallery Upload Error jpeg mime type
  • 2013/8/12 23:09

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


I don't know what to tell you - I tested on mine and it working.

I have committed my files to XOOPS SVN, so see if you've missed something.

If somebody else could test it, please let me know. If I've missed something, then we need to fix it.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

5
Cifug
Re: ExtGallery Upload Error jpeg mime type
  • 2013/8/13 9:01

  • Cifug

  • Quite a regular

  • Posts: 208

  • Since: 2007/12/13


Quote:

Mamba wrote:
I don't know what to tell you - I tested on mine and it working.

I have committed my files to XOOPS SVN, so see if you've missed something.

If somebody else could test it, please let me know. If I've missed something, then we need to fix it.


Hi Mamba, just re-edited the files you mentioned above with no luck.

Checked your SVN link (by the way your link is to extcal not extgallery) and downloaded the correct relevant files from extgallery trunk SVN and uploaded them and still no luck

Are you sure that's all you changed? Should I download the entire module?

Best regards,
Marty.


6
Mamba
Re: ExtGallery Upload Error jpeg mime type
  • 2013/8/13 12:59

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
Are you sure that's all you changed? Should I download the entire module?

You might try and see if it helps.

I just checked it on another server, and without the changes, the .jpeg file is not visible when I check in modules/extgallery/admin/photo.php.

Once I copy over the changed files, the .jpeg file is visible just fine, and I can import it in the batch.

Tested on PHP 5.4.17 and PHP 5.5.1
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

7
Cifug
Re: ExtGallery Upload Error jpeg mime type
  • 2013/8/13 22:42

  • Cifug

  • Quite a regular

  • Posts: 208

  • Since: 2007/12/13


Quote:

Mamba wrote:
[quote]and I can import it in the batch


ahh, I am having this error in the standard upload form on user side and admin side. I haven't tried batch upload yet. I will try batch upload when I get home this afternoon.

in the meantime can you try standard form user and admin side please to see if you have same problem?

thanks,
Marty.

8
Cifug
Re: ExtGallery Upload Error jpeg mime type
  • 2013/8/14 7:50

  • Cifug

  • Quite a regular

  • Posts: 208

  • Since: 2007/12/13


Ok, woohoo batch upload does work Almost got it sorted...

The photo is also converted from .jpeg to .jpg which is interesting Is this intended? Can we not keep the same file format/extension?

However, I still cannot upload a photo with .jpeg extension via the standard upload form on user or admin side and I suspect that no-one else can either.

The reason I would like this feature to work apart from the fact that it should, is I can't use the "batch upload" feature when using my phone, and even if I could it would be adding a whole other step and software to upload a photo. Would be a royal PITA...

Any ideas?

Cheers,
Marty.

9
Mamba
Re: ExtGallery Upload Error jpeg mime type
  • 2013/8/14 8:46

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
The photo is also converted from .jpeg to .jpg which is interesting Is this intended? Can we not keep the same file format/extension?

Hmm, I was not aware of it - I'll need to check on this.

Quote:
However, I still cannot upload a photo with .jpeg extension via the standard upload form on user or admin side and I suspect that no-one else can either.

Go to the file /extgallery/photoUploader.php and in line 172 replace:

IMAGETYPE_JPEG => 'jpg',

with:
IMAGETYPE_JPEG => 'jpeg'IMAGETYPE_JPG => 'jpg',


and on line 248 just add

IMAGETYPE_JPG,

But this is all hard-coded , and we'll need to change it to something in preferences, where the Admin can select which extensions are allowed. Publisher has such a "Mime types Management", and we'll need to make it portable, so it is easily implemented in each module.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

10
Cifug
Re: ExtGallery Upload Error jpeg mime type
  • 2013/8/14 12:36

  • Cifug

  • Quite a regular

  • Posts: 208

  • Since: 2007/12/13


Hi Mamba,
Quote:
Mamba wrote:
Go to the file /extgallery/photoUploader.php


Took me a while but I worked out that you meant /extgallery/class/photoUploader.php

Your fix works perfectly for .jpeg but now .jpg has the error

I reverted back to the original file and back to where I was in the beginning and tried to do a batch upload with a .jpg and a .jpeg together and they both worked fine with no issues.

I'm thinking we're almost there

If I look in my local photo folder on my PC I notice that both .jpg and .jpeg files are associated (by the file type column) as JPEG file types. I think this is why if we change the code from
IMAGETYPE_JPEG => 'jpg',

to
IMAGETYPE_JPEG => 'jpeg'IMAGETYPE_JPG => 'jpg',

the .jpeg worked and .jpg failed. Because the server is looking for
IMAGETYPE_JPEG =>

So, I tried
IMAGETYPE_JPEG => 'jpeg'IMAGETYPE_JPEG => 'jpg',

and
IMAGETYPE_JPEG => 'jpeg','jpg',

these all failed.

What I did find was that no matter what combination I had, if this
IMAGETYPE_JPEG => 'jpeg',

is in there the .jpeg will always work and the .jpg will always fail. The only time .jpg works is with
IMAGETYPE_JPEG => 'jpg',


So I thought to go back to basics and try
IMAGETYPE_JPG => 'jpg',

and neither .jpg or .jpeg worked they both failed.

Of course I'm only guessing. But thought I should pass on my 4 hour attempt at trouble shooting if not for any other reason than to give you guys a laugh

So...on with the show!! What else can we do??

Marty.

Login

Who's Online

348 user(s) are online (252 user(s) are browsing Support Forums)


Members: 0


Guests: 348


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits