简体   繁体   中英

Selecting an image from Photo Gallery Android 4.4 with native browser get image:whatever

I made a simple application where selects a file from local storage and use jQuery prop files.

I tested on native browser in Android 4.4 and I get strange name: image%3A12 . I don't know why.

My simple html page:

<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>

<body>
<form>
   <input type="file" />
   <p></p>
</form>

<script>
$(function(){
   $(":file").on("change", function() {
      var files = $(this).prop("files");
      $("p").text(files[0].name);
   });
});
</script>
</body>
</html>

There is a bug for native browser or is a workaround to get image file name ?

One more thing, if I choose Camera option (instead of pick Documents to choose picture already saved in system), then I get correct filename with extension...

在此处输入图片说明

在此处输入图片说明

And if I select same picture (saved one), I got:

在此处输入图片说明

image%3A12 is an encoded string which on decoding is image:12

%3A simply means : likewise '%20'means BlankSpace when Encoded/Decoded

You can use the following site to check it http://meyerweb.com/eric/tools/dencoder/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM