Adding file to the dhtmlx vault list

Hello Team,

i tried below method to add some file default in dhtmlx vault.its added successfully but i am not able to get file name on this method on delete when i “alert” the file object during delete by using “onBeforeFileRemove” method it displays “void” for file.name.why is that?

var files = [{id:1,name:}]
for(var q=0;q<files.length;q++){
var f=files[q];
myVault.file_data[f.id]=f.id;
myVault.file_data[f.name]=f.name;
myVault.file_data[f.serverName]=f.serverName;
myVault._addFileToList(f.id,f.name,f.size,f.serverName,“uploaded”,100);
myVault.list.updateFileState(myVault.file_items[f.id],{state:“uploaded”,str_done:myVault.strings.done});
}

Please provide necessary guidance.

Thank

Sorry the file object is as below
var files = [{id:1,name:“get_detail.docx”,size:5465565,serverName:“get_detail.docx”}]

Thanks

hi

  1. init vault
myVault = new dhtmlXVaultObject({....});
  1. list of files to add as “uploaded” into vault list

var files = [ {id: myVault.conf.idd++, name: "terms and conditions.docx", size: 2724033}, {id: myVault.conf.idd++, name: "screenshot.png", size: 603777} ];

  1. adding files into vault

for (var q=0; q<files.length; q++) { var f = files[q]; myVault.file_data[f.id] = {}; myVault._addFileToList(f.id, f.name, f.size, "uploaded", 100); myVault.file_data[f.id] = { name: f.name, size: f.size, state: "uploaded" }; myVault.conf.uploaded_files[f.id] = { realName: f.name, serverName: f.name||f.serverName }; myVault.list.updateFileState(myVault.file_items[f.id], {state: "uploaded", str_done: myVault.strings.done}); }

  1. event

myVault.attachEvent("onBeforeFileRemove", function(){ console.log(arguments) return true; });

  1. event log (after pressing button clear all)

[Object { id=1, name="terms and conditions.docx", size=2724033, more...}] [Object { id=2, name="screenshot.png", size=603777, more...}]

not sure I understood you properly. please attach any image/screenshot with info what kind of image/where it should be placed?

Hi

Latest version of dhtmlxVaul have this functionality as a native. Please use it.