Fixing The WordPress 2.5 Flash Uploader On Mac
15 April 2008I had a big problem getting WordPress’s new-fandangled flash image uploader working on my Mac; the flash uploader button wouldn’t appear and I always saw the standard single image uploader button.
After a bit of research using the Safari Develop menu, I found that using a Windows user agent made it appear, and a Mac user agent would hide it.
After a quick delve into WordPress’s code I found this in /wp-admin/includes/media.php, lines 769-772…
769: // If Mac and mod_security, no Flash.
770: $flash = true;
771: if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), ‘mac’) && apache_mod_loaded(’mod_security’) )
772: $flash = false;
…which turns off the flash uploader if you’re using a Mac and your website runs Apache and has the mod_security module loaded… mine does!
So, commenting out the bottom two lines…
769: // If Mac and mod_security, no Flash.
770: $flash = true;
771: // if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), ‘mac’) && apache_mod_loaded(’mod_security’) )
772: // $flash = false;
…now forces WordPress to show the flash uploader regardless.
Hurrah

7 Responses to “Fixing The WordPress 2.5 Flash Uploader On Mac”
Josh | 20 April 2008 at 02:03
Well, this was an adventure. Doing what you did fixed the multiple-image upload, but I ended up having a new problem: images weren’t uploading in order (ie, usually imagea uploads, then imageb, then imagec, but instead it went like imageb, imagec, imagea). As a result my gallery was out of order. I tried doing “orderby” by various things including post_name, post_title, and guid - all of which should have ordered the images by filename alphabetically, but with no luck.
When I finally sifted through the code and found where it wrote the query…then changed it in phpmyAdmin (such as changing the default “menu_order ASC, ID ASC” to “menu_order DESC, ID DESC”) I found that…changing the orderby did absolutely nothing to actually change the order! The query the wrote appears to be broken when it comes to the orderby! Indeed, changing it in the code itself didn’t work either.
I ended up tracking the problem down and saw that the orderby string was being surrounded by quotes and had a DESC following it for some reason eg: ORDER BY “menu_order ASC, ID ASC” DESC. When I took the DESC and quotes out, it worked.
I was able to do this by going into wp-includes/media.php and changing line 355 to:
$attachments = get_children(”post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}”);
and thereby taking out the quotes, then going to wp-includes/post.php on line 473 and taking out $order from the end of the query string. This appears to fix the orderby problem, at least for me.
What a pain, but at least I could fix it…
Josh | 20 April 2008 at 02:06
correction - post_title will order by *gasp* the title you give the image. It just happened that I hadn’t changed the titles in the post I was working in above, so it just LOOKED like it was sorting by filename. It appears that post_name and guid both sort by filename, however - post_name by the file name without extension, guid by the full url.
Armando | 20 June 2008 at 18:28
you saved my day! thank you very much for this fix
naz | 27 December 2008 at 16:57
huh, i’m lost i don’t understand.
Ben | 27 December 2008 at 21:43
This may not be applicable for any version other than the original 2.5 release… I’m not sure… I would think that now the release version is 2.7 it has been fixed, but I can’t verify this.
@naz - this fix is a bit technical and requires a bit of behind the scenes hacking. If you’re not sure what those bits of code indicate I’d give this one a miss.
Photo Diva | 06 January 2009 at 06:40
This seems like it will help tremendously. Thank you for spending the time on that. Now perhaps we can go into lesson 2 where you direct me on how to put in the code. Much respect.
Martine | 16 September 2009 at 10:15
Ben, you are an angel for posting this. I have been pulling my hair out for months to try to get this sorted. Your fix worked perfectly.
THANK YOU THANK YOU THANK YOU!
Leave a Reply