This is a migrated thread and some comments may be shown as answers.

Issue in File browser for iphone in jquery mobile

1 Answer 66 Views
jQuery Mobile
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Deepan
Top achievements
Rank 1
Deepan asked on 19 Dec 2013, 01:01 PM
when using Android, I Got correct file name from file Browser  but using Iphone i got file name as "image.jpg"  for every Images
Please give me solution for this

. html
--------

<input type="file" name="file_browse" id="file_browse"/>

.js
---

    var input = document.getElementById("file_browse");
    var file=input.files[0];
    var fileName=file.name;

1 Answer, 1 is accepted

Sort by
0
Ivo Bratoev
Telerik team
answered on 23 Dec 2013, 02:32 PM
Hi,

It seems IOS does not support file input completely. They added partial support in IOS 6 (http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers) but it is not full and doesn't handle you scenario.
You can try using the Camera.getPicture API from Cordova:
http://cordova.apache.org/docs/en/3.2.0/cordova_camera_camera.md.html#camera.getPicture . Here is a small example that works on my IOS 7 device:

navigator.camera.getPicture(onSuccess, onFail, {
    destinationType: Camera.DestinationType.FILE_URI,
    sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
    mediaType: Camera.MediaType.Picture,
    encodingType:Camera.EncodingType.PNG
});
 
function onSuccess(imageURI) {
    alert(imageURI);
}
 
function onFail(message) {
    alert('Failed because: ' + message);
}

Regards,
Ivo Bratoev
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
Tags
jQuery Mobile
Asked by
Deepan
Top achievements
Rank 1
Answers by
Ivo Bratoev
Telerik team
Share this question
or