我希望得到一个文件名的路径,就像输入字符串/storage/emulated/0/Pictures时得到结果
/storage/emulated/0/Pictures/
/Photo-2017-02-17-10-08-38_2271.JPG
我该如何用 JavaScript 来做?谢谢!
最佳答案
尝试
var fullpath = "/storage/emulated/0/Pictures/Photo-2017-02-17-10-08-38_2271.JPG"
var pathWithoutFileName = fullpath.substr(0, fullpath.lastIndexOf('/') + 1);
关于javascript - 当我在javascript中输入完整文件名时如何获取文件路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42664991/