How to upload multiple files on Android using the multiple property?

烈酒焚心 提交于 2019-12-03 16:14:18

问题


I got a,

<input type="file" multiple accept="image/*" />

and I want my android users to be able to upload multiple files at a time. Users using nexus-5 report being unable to upload multiple files at a time. I also tried adding capture="camera" to the input but this only auto open the camera and only associate one picture at a time again. This works everywhere except on Android.

Is there anything I am missing?


回答1:


I've hit the same brick wall. I've tried a number of mobile browsers and can't find any that work.

I found this link that tells you that none of the Android browsers support this: http://caniuse.com/#feat=input-file-multiple

From extensive searching, I've seen information that suggests that Chromium supports this (but no beta yet) and it should make it into Chrome for Android but no indication of time-frame.




回答2:


This seems to have changed since my last answer. If you now look at: http://caniuse.com/#feat=input-file-multiple

You'll now see that Chrome 42 (or better) for Android does now support multiple file upload provided you're running Android 5.0 or better. That's quite a limitation but at least it's an improvement. As Android 5 (Lollipop) gains market share (18.1% in August 2015) this become more practical.




回答3:


Here's one trick. Hit your normal <input type='file' multiple> button. File picker appears: do a long press on a file to select it, then select other files. On the top bar an "Open" appears, select it and then multiple files are added to the files collection. Kudos to Simon@atp for this.

However, not all available file pickers may work.




回答4:


As of 12/20/2017, the new Chrome browser is allowing multiple file selection. Just select your files and click "Open" in the upper right hand corner.




回答5:


You could work around this limitation by using javascript, canvas and blobs.

See https://github.com/josefrichter/resize/blob/master/public/preprocess.js for some example code to get you started.




回答6:


I have a similar problem. And I tested the latest chrome and FireFox, both not working.

But the QQ browser which is using X5 core is seems to be the only browser works as I expected. So My solution would be using a App shell to encapsulate the X5 SDK.



来源:https://stackoverflow.com/questions/25412406/how-to-upload-multiple-files-on-android-using-the-multiple-property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!