1

I am using ckfinder in my project.
How can I access to ext of selected files?

function BrowseServer(element) {
    var finder = new CKFinder();
    finder.lang = 'fa';
    finder.selectActionFunction = showFileInfo;
    finder.popup();
}

function showFileInfo(fileUrl, file, files) {
    // some code here
}

Is there any options for do this?

Majid Basirati
  • 2,665
  • 3
  • 24
  • 46

1 Answers1

0

From what I have checked file extension is only available in fileUrl so it seems the only way of getting to extension of selected file is using string operations e.g.

function showFileInfo( fileUrl, data, files )
{   
    console.log(fileUrl.substring(fileUrl.lastIndexOf(".")));   
...

NOTE: files contains an array of all selected files. Single item contains url and an data object holding the following proprties: fileSize, fileDate, fileUrl and selectActionData. You can get to every selected file extension there e.g.

var url = files[0].url;
console.log(url.substring(url.lastIndexOf(".")));
//or
console.log(files[0].data.fileUrl);
j.swiderski
  • 2,405
  • 2
  • 12
  • 20