Am using the file plugin to stream files to the server and renaming them with the primary key (because of versioning) from a table using code
- Code: Select all
if (vPath)
{
var new_name = "/" + vID + vFiletype;
plugins.file.streamFilesToServer(vPath, new_name);
}
this works perfectly as per the tool tip allowing me to rename the file and saving the file in the default server directory .
I want to do the same thing using 'streamFilesFromServer' (to change the filename back to its original) and as per the tooltip
plugins.file.streamFilesFromServer(file/fileName|fileArray/fileNameArray, serverFile/serverFileName|serverFileArray/serverFileNameArray, [Function callbackFunction])
this should be possible. The samplecode however is different as:
- Code: Select all
// transfer all the files of a chosen server folder to a directory on the client
var dir = plugins.file.showDirectorySelectDialog();
if (dir)
{
var list = plugins.file.getRemoteFolderContents('/images/user1/', null, 1);
if (list)
{
var monitor = plugins.file.streamFilesFromServer(dir, list, callbackFunction);
}
}
and there doesn't seem to be a way that i can rename the file as it is done in 'streamFilesToServer'. Am i missing something? Is this possible? What is the best way to rename the file during or after it is streamed?
Any help would be appreciated.