Living in 2012 I did not think a image upload using PHP would cause so many difficulties.
My requirements are:
- multiple file upload
- cross-browser functional
- considering security issues
- depending on the least possible add ons or extensions
- supporting drag&drop (would be nice, at least)
The options to be available seem to be to me:
-
simple single file upload (or several single file inputs, but you still have to select each image manually) using PHP (and e.g. GD library) only
(+) Pros: fully cross-browser functional, not depending on neither flash, nor javascript, nor html5, nor any add ons etc., maximum of customizability
(-) Cons: bad user experience as no support of multiple files, no drag & drop etc
-
a compromise, using e.g. jquery
as promoted on many posts and other sites, seen this link, e.g.: http://blueimp.github.com/jQuery-File-Upload/
(+) Pros: supporting multiple file uploads and even drag and drop besides other nice features for mostly only FireFox, Chrome, Safari (see link for details)
(-) Cons: only single selecting files and no drag & drop for IE (tested on IE6-IE8 by myself)
-
HTML5: browser market shares don’t seem to allow to depend on HTML5 only, still…
-
Flash: I found many different uploaders based on flash, but when testing, many did not fulfill what they claimed (e.g. select multiple files and cross-browser functionality). Two examples I found useful:
http://www.uploadify.com/demos/
http://code.google.com/p/swfupload/ (see http://demo.swfupload.org/v220/ for Demos)(+) Pros: those mentioned supporting multiple file uploads
(-) Cons: no drag and drop, depending on Flash add on, and I am not a security expert nor very familiar with flash, but the documentation of swfupload e.g. states they cannot/do not check the Mime-Type of uploads and totally rely on checking the file extension)
However, I found statements that e.g. google docs uses multiple file upload not based on flash but still working in IE too. Has anybody an idea how they do that?
My other questions were: did I oversee an opportunity? Are those all of the better options available? Is there any non flash-based way for at least multiple file upload working in IE (at least v8) too? How do you guys do it? Or is it really waiting and hoping for the breakthrough of HTML5 and now having 5 different uploaders, each optimized for a special browser/add on availability?
Thank you very much in advance!
It looks like you did your research pretty thoroughly. I discovered a similar conundrum back a few weeks ago. As for the Google Docs ref, I would really like to see that because I have never found anything like that. Personally if your dealing with a younger audience for your site I would recommend using the jQuery option and displaying a browser recommendation of Firefox or Chrome to IE users. Go Flash for the older crowd that will be more likely to be on IE.
Unfortunately there is no winner here really that I have found. But at least with the jQuery option you avoid Flash AND have the potential that IE will work with it in future versions. With HTML5 Flash is quickly disappearing (and good riddance). Now if that would only happen with IE. I mean come on, how is it that even in IE9 they don’t even come close to their competitors at being standards complaint??? Its just ridiculous.