0

So I've been using ImageMagick for quite some time now, but it just recently stopped working in Firefox specifically. I'm running the following line of code:

exec('/usr/bin/convert /home/usr/public_html/upload/'.$filename.'[0] /home/usr/public_html/upload/'.$newfilename);

It just converts an uploaded PDF file into a JPG for previewing purposes. Now, this has been working fine every since today. Now it will upload the PDF fine, but won't create the JPG. There's no errors or error log, it just sits there.

This also only happens in Firefox (tested with IE and Chrome, works fine). Now my question is, does anybody have any idea on why this would be happening? Or has anybody came across this before?

Any help would be terrific, thanks!

Aaron
  • 531
  • 3
  • 8
  • 22
  • shift+refresh and it magically doesn't work fine... – wesside Sep 26 '12 at 22:51
  • It's not a browser issue, you're missing something small, but based on what you gave me, I can't tell you. – wesside Sep 26 '12 at 22:57
  • @bigman I did try shift+refresh and manually clearing all cache in all browers, but I still get the same result. Works in IE and Chrome, not in Firefox. Thank you for your help. I must be missing something... – Aaron Sep 26 '12 at 23:03
  • It is very likely that it does not work in Chrome and IE anymore. Clear cache in those two and see if it breaks there. Seems like a file system problem if you have a lot of files there. – McKracken Sep 26 '12 at 23:24
  • @McKracken That's what I originally thought. I've cleared the cache on IE and Chrome as well, still get the same result. If you happen to have some time, feel free to try in Firefox: [Here's the Link](http://www.shmoggo.com/m80/uploader/upload.php). the formatting will be off, but should get the job done. – Aaron Sep 26 '12 at 23:35
  • @markus-tharkun Yes, required by our hosting provider to run external programs. – Aaron Sep 26 '12 at 23:43
  • @Aaron Just tried it and it works in my firefox. – McKracken Sep 26 '12 at 23:50
  • Guys: did you know there are many Chromes, Firefoxes, IEs and Mozillas out there in the big, big world?!? You'd surely help each other better if you stated which version 'my' browser is each time you mentioned 'it works' or 'it doesn't'..... – Kurt Pfeifle Sep 26 '12 at 23:52
  • @KurtPfeifle: Ofcourse we are aware, just in this case it *can't* be a browser issue at all. :) – McKracken Sep 26 '12 at 23:54
  • @McKracken Ha, seriously? Thanks a ton for trying it out. This is quite the pickle... obviously just my computer/setup then huh? – Aaron Sep 27 '12 at 00:03
  • @Aaron It is probably an issue with your host. – McKracken Sep 27 '12 at 00:10
  • @McKracken I actually went to them first (they weren't much help), but I'll definitely try them again. Thank you very much for your time and help. Hopefully I'll answer this question soon. – Aaron Sep 27 '12 at 00:12

1 Answers1

0

It turns out having this file type limitation was refraining a PDF file from even being uploaded in the first place.

if ($_FILES["picture"]["type"] == "application/pdf")

This only happened when using Firefox. Chrome and IE seemed to respond fine to this (yes, I did happen to test a few older versions as well). There were also rare occasions on the exact same version of Firefox where it worked fine on other people's systems.

My solution ended up being to remove the PHP file check and put a javascript file check on the other end instead. It now seems to be working in all major browsers.

Thank you everybody for your help!

Aaron
  • 531
  • 3
  • 8
  • 22
  • Never trust MIME type identification which you got from clients browser! Always identify filetype locally on the server! See [php file upload](http://www.php.net/manual/en/features.file-upload.post-method.php) and "...This mime type is however not checked on the PHP side and therefore don't take its value for granted...." – Petr Oct 02 '12 at 08:37
  • @Petr Terrific, thank you very much. I knew somebody could shed some more light on this. – Aaron Oct 02 '12 at 10:49