<input type="file"> behaviour in a ionic app on Lollipop

We want to use the camera (as an option) with the HTML input type=file element. But how?

I’ve put a vanilla index.html in my app.

<!doctype html>
<html>
<body>
<input type="file">
</body>
</html>

If test this in my app I don not get the option to use the camera. I get this instead:

If I run this on the android web browser I get this:

2 Likes

You have to specify camera or it will just think the input is looking for any file.

<input type="file" accept="image/*;capture=camera">

May want to look into the cordova-camera api though as it offers more options.

http://learn.ionicframework.com/formulas/cordova-camera/

Robert

Nope we tried that already… still no camera selection…

Yes, you are right. I tried it in lolipop and did the same thing. Is there some specific need for using the file input? Can I get a little more background? What are you doing with the image or image URI?

You could use the cordova-camera plugin to get the image and store the image uri in a hidden input field. I have done this with great success.

Ok thanks for your reply.

We already build it with plugins. But our manager :smile: wanted it to be build with standard HTML.
We like to have file selection + image capture. (just like in the browser… !)

So there are we are at now.

Perhaps it is a limitation of the enclosing webbrowser control at the java side? Could we fix it there?

Bump, would like to know this too…

We already build it with plugins. But our manager smile wanted it to be build with standard HTML.

Your manager sounds like an asshole

Hi everyone,

If anyone is still looking for the solution, installing Crosswalk should fix the problem

http://blog.ionic.io/crosswalk-comes-to-ionic/

Cheers (:

It fix the camera issue, but I still cant not use the multiple file selectors