开发者

Most compatible solution for multiple file upload input

开发者 https://www.devze.com 2023-02-25 06:13 出处:网络
Since 开发者_高级运维natively IE7 (and some others browsers, haven\'t checked yet, to be precise) doesn\'t use <input multiple=\"\" /> parameter, I would love to know what is... the most compati

Since 开发者_高级运维natively IE7 (and some others browsers, haven't checked yet, to be precise) doesn't use <input multiple="" /> parameter, I would love to know what is... the most compatible (varies by preference, yes, yes) solution for one input field, multiple file upload.

It would be nice, if there would be no JavaScript involved in solution, but I somehow have this strange feeling, that it is impossible - correct me if I'm wrong.

Thanks in advance!


The most browser compatible pure HTML method of allowing multiple file uploads is to simply have multiple:

<input type="file" />

You can alternatively use Java or Flash uploaders -- but these are probably less compatible then JavaScript.

JavaScript which degrades gracefully is probably your best bet, check out Valum's File-Uploader. The library allows you to make use of:

  • Multiple file uploading through the upload form element if the browser supports it.
  • Drag and drop file uploading if the browser supports it
  • Degrade all the way down to an HTML input form element if the browser has JavaScript disabled.

It is very good practice to develop for the latest browsers, while supporting older browsers (not the other way around). If people are on older browsers or don't have JavaScript enabled, then multiple file uploading is going to be painful regardless of what you do.


Our world as yet to bestow on to us such a tool/control ...

But I think the best your going to get, if you don't want to use any client-side technologies (Like javascript or Flash), is to let the user upload a file with a normal POST and then somehow (maybe in your session) remember the files that the user uploaded or just save them to the database as they come in.

So the process would be:

  1. the user selects a file and uploads;
  2. you display the image and ask if they want to upload another file;
  3. you then give them a option to go to the next page or do some action.

Probably not the best way to approach this but it should work.

Then again if you are willing to use Javascript or Flash there are tons of scripts out there that would allow you to upload multiple files. So maybe look for one that gives only one input and populates a list of selected images?

Just my 2 cents ...

0

精彩评论

暂无评论...
验证码 换一张
取 消