2017-02-21 67 views
0

我做了一个简单的应用程序,从本地存储中选择一个文件并使用jQuery prop文件。从本地浏览器Android 4.4选择图像获取图像:无

我在Android 4.4的原生浏览器上测试过,我得到了一个奇怪的名字:image%3A12。我不知道为什么。

我简单的HTML页面:

<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> 

没有为本地浏览器bug或者是一个变通方法来获取图像文件名?

还有一两件事,如果我选择Camera选项(而不是挑Documents选择已保存在系统中的图片),然后我得到推广正确的文件名...

enter image description here

enter image description here

如果我选择相同的图片(保存一张),我得到:

enter image description here

回答

0

image%3A12是编码的字符串,其在解码时是image:12

%3A仅仅意味着:同样“%20'means BlankSpace当编码/解码

可以使用以下网站,以检查它 http://meyerweb.com/eric/tools/dencoder/

+0

我知道这是编码字符串,你没有回答我的问题:'有本地浏览器的错误,或者是解决方法来获取图像文件名? –