var dir = plugins.file.showDirectorySelectDialog();
if (dir) {
var list = plugins.file.getRemoteFolderContents(‘c:\’, null, 1);
if (list) {
var monitor = plugins.file.streamFilesFromServer(dir, list);
}
}
i try differente conbinations of the first parameter of the function getRemoteFolderContents like this : (‘c:\’,‘/images/user1/’,’ C:\Programmi\Servoy\application_server\server\webapps\ROOT\') but the var list have every time value empty
there is an alternative method to send a file from server to client or where I’m wrong in using the function?
getRemoteFolderContents takes a relative path, not an absolute path.
You should have set the servoy.FileServerService.defaultFolder property in the server-admin/plugins page (and using c:// is NOT recommended as it opens the door to your whole server, so put that in a folder somethere but don’t give access to your C drive!)
Then you can do:
var files = plugins.file.getRemoteFolderContents(“/”);
And it will give you back a list of files inside that location.
In the wiki not write that about relative path, but i try to watch then property
var tmp=servoy.FileServerService.defaultFolder;
but the servoy give me a sintax error, i try to use the
var tmp= plugins.file.getDefaultUploadLocation();
and give the path “C:\Programmi\Servoy\application_server\server\webapps\ROOT\uploads”
there is some file in that path, and i put another file in that path
i yet try with the code:
var files = plugins.file.getRemoteFolderContents(‘/’);
but with the single quotes ( ’ ) not run. I try with the double quotes ( " )
the function getRemoteFolderContents run correctly, in the wiki there is the sigle quote, i think there is a mistake in the wiki!
Thanks so much for your help!!!
ptalbot:
getRemoteFolderContents takes a relative path, not an absolute path.
You should have set the servoy.FileServerService.defaultFolder property in the server-admin/plugins page (and using c:// is NOT recommended as it opens the door to your whole server, so put that in a folder somethere but don’t give access to your C drive!)
Then you can do:
var files = plugins.file.getRemoteFolderContents(“/”);
And it will give you back a list of files inside that location.
In your case “C:\Programmi\Servoy\application_server\server\webapps\ROOT\uploads” is just the default upload folder, but you can set that in the servoy admin page, go to plugins and set the property “servoy.FileServerService.defaultFolder” to the folder you want.
But I wonder why it’s not working for you with single quotes, in javascript ‘/’ === “/” so it should work as well.