input type=“file” accept=“image/*” doesn't work in phone gap?

牧云@^-^@ 提交于 2019-12-10 22:33:57

问题


I tried to make a android app using HTML + phonegap 2.6.0 which is support:

<input type="file" />

By default, if the HTML is open via android browser itself, it will show "camera" , "gallery" , "dropbox" etc when clicking @ browse button. But if I run the HTML on app webview, file chooser is coming up which is we can choose from gallery, dropbox, music track etc except from camera.

I tried to use:<input type="file" accept="image/*" /> perhaps when I run the app it will showing camera icon to choose. Unfortunately no.

My objective is when i press on browse button, the camera icon is showing up together with gallery etc.. It is possible to do this with phonegap? :(


回答1:


For same need, i've madea custom menu with 2 button ! Take from camera / take from picture. After just use phone gap function camera.getPicture that opens the device's default camera application so that the user can take a picture (if Camera.sourceType = Camera.PictureSourceType.CAMERA, which is the default). Once the photo is taken, the camera application closes and your application is restored.

If Camera.sourceType = Camera.PictureSourceType.PHOTOLIBRARY or Camera.PictureSourceType.SAVEDPHOTOALBUM, then a photo chooser dialog is shown, from which a photo from the album can be selected.

http://docs.phonegap.com/en/2.6.0/cordova_camera_camera.md.html#Camera



来源:https://stackoverflow.com/questions/16169652/input-type-file-accept-image-doesnt-work-in-phone-gap

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