I hope to get the path of a filename, just like get the result /storage/emulated/0/Pictures/ when I input the string /storage/emulated/0/Pictures/Photo-2017-02-17-10-08-38_2271.JPG
How can I do in javascript? Thanks!
var fullpath = "/storage/emulated/0/Pictures/Photo-2017-02-17-10-08-38_2271.JPG"
var path = fullpath.substr(0, fullpath.lastIndexOf('/') + 1);
The +1 is to include the last forward slash.
var path = filename.match(/(.*)[\/\\]/)[1]||'';