var myFileName = fileList[i];
var myIndex = myFileName.lastIndexOf('/');
//error
Anyway, the problem was that the file path as I had grabbed it was not really a string, even though it looks like one. I needed to use toString() on it before using lastIndexOf() and then all was well.
var myFileName = fileList[i].toString();
var myIndex = myFileName.lastIndexOf('/');
Then I remembered "fsName." I've used it in my other scripts, but I thought it just changed the ugly "%20" code back into spaces. It turns out that it also turns the path into a string. So you get two for one.
var myFileName = fileList[i].fsName();
var myIndex = myFileName.lastIndexOf('/');
No comments:
Post a Comment