capacitor use input type file to select between Camera and file browser
Asked Answered
T

0

7

I’m trying to have the same behavior as in Google Chrome on Mobile,

When I have an input type=“file”, it opens a selector to choose between Camera and file Browser

I tried the following :

<input type="file" accept="image/*;capture=camera" /> and <input type="file" accept="image/*" />, they both gives the ability to choose on Chrome mobile but directly open the file browser on capacitor

<input type="file" accept="image/*" capture="environment"/> opens directly the camera without the option to choose.

Anyway i can get the same behavior of Chrome on mobile ? I tried to check the standards but apparently accept=“image/*” should be enough

Thanks,

Tiliaceous answered 15/5, 2021 at 12:0 Comment(2)
You could have a look at this npmjs.com/package/capacitor-file-selector. medium.com/@hinddeep.purohit007/…Unharness
I'm trying to get my capacitor app to directly open the camera, like you describe with the second alternative. Did you need to add any other permissions than CAMERA for this to work? Capacitor always opens directly the file manager. Did you end up finding an answer for this question?Nguyetni

© 2022 - 2024 — McMap. All rights reserved.