【问题标题】:Get Filename with Cordova使用 Cordova 获取文件名
【发布时间】:2018-06-18 18:49:12
【问题描述】:

使用 Cordova,如何根据文件的 URI 获取带有扩展名的文件名?

例如,在我的应用程序中,使用了这两个 URI:

file:///storage/emulated/0/Android/data/com.myapp.mobile.subdomain/cache/IMG_20180503_125311.jpg?1529347191687

content://com.android.providers.media.documents/document/image%3A690

第一个容易得名,第二个是不可能的。

【问题讨论】:

    标签: javascript android cordova cordova-plugins


    【解决方案1】:

    问题已解决:

    window.resolveLocalFileSystemURI('file://example.jpg', function (fileEntry) {
        fileEntry.file(function (myFile) {
    
            return myFile.name;
    
        }, function () {
            console.log('error');
        });
    
    }, function (e) { });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-18
      • 2017-10-28
      • 2010-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多