When I add a file to Vault, I will know the a file id for the file with onFileAdd event handler.
I am wondering if I can pass the file id to serve in order to attach more information regarding the file.
Hi
you need different extra info for each uploaded file, correct? what browser version?
also please specify vault version
Hi Andrei.
Actually, I want to send some unique information to server for each uploading file.
I use dhtmlxVault 2.4 Pro on Chrome 41
Thanks!!
Hi
the quickest way is the following trick
(take any demo, add missing code and you will see)
// init vault as usual
myVault = new dhtmlXVaultObject(t);
// change main upload function a bit
myVault._doUploadFile2 = myVault._doUploadFile;
myVault._doUploadFile = function(a){
// I not sure what exactly data from each file you need, blow is an example
// console.log(this.file_data[a].name, this.file_data[a].size);
// add extra data to url (I used dhx4.newId())
this.setURL(uploadUrl+"?random="+dhx4.newId());
// and call native code
this._doUploadFile2.apply(this, arguments);
}
Hi Andrei,
Thank you so much for your help…
It works well!!
Hi Andrei
When I encode it the value dhx4.newId() like encodeURIComponent(dhx4.newId()), the value gets bad unlike passing values as multipart/form-data.
Is there any way that I can pass extra params like below example as multipart/form-data when I upload a file?
example,
this.setURL(uploadUrl+"?random="+encodeURIComponent(dhx4.newId()))
Thank you!
Travis
Hi
You probably have to decode it on server side?