How do I create a folder in the server?
Does Servoy have an existing API for this or should I create a plugin for that feature?
Thanks.
How do I create a folder in the server?
Does Servoy have an existing API for this or should I create a plugin for that feature?
Thanks.
What do you mean by creating a folder in the server?
Is that a folder where you want to put uploads using the file plugin?
If that’s the case, you don’t need to create it, just put a path (starting from ‘/’ which represents your default upload folder) with as many subfolder as you want and the plugin will create the relevant folders if needed, for example
/path/to/my/image.png
Will create this hierarchy:
/path
/to
/my
/image.png
ptalbot:
What do you mean by creating a folder in the server?
Is that a folder where you want to put uploads using the file plugin?If that’s the case, you don’t need to create it, just put a path (starting from ‘/’ which represents your default upload folder) with as many subfolder as you want and the plugin will create the relevant folders if needed, for example
/path/to/my/image.png
Will create this hierarchy:
/path
/to
/my
/image.png
What is the “default upload folder”? How do I set it? How do I create a folder in the server in C drive and folder test (C:/Test/)?
The “default upload folder” is the one you can set in the servoy-admin plugins page, under the FilePlugin, you will see a property “servoy.FileServerService.defaultFolder”, set it to “C:/Test/” and you’re all set!
If this property is empty, the plugin will try to locate or create a folder named ‘/uploads/’ in your ‘/application_server/server/webapps/ROOT/’ directory.
Hope this helps,
This will help.
thanks.
When I set the Plugin properties to “C:/Test/” and call createFolder method of File plugin, it creates a new folder on C and not in C:/Test.
And File Plugin suddenly disappeared from the Server Plugins page, but it is still in servoy.properties as servoy.FileServerService.defaultFolder.
After 3 times of restaring server, the path came to effect.
This is nice… thanks…
erikd:
When I set the Plugin properties to “C:/Test/” and call createFolder method of File plugin, it creates a new folder on C and not in C:/Test.And File Plugin suddenly disappeared from the Server Plugins page, but it is still in servoy.properties as servoy.FileServerService.defaultFolder.
“createFolder” doesn’t work on remote folder, it works on the client, (if anything, you would have a createRemoteFolder)
What happens here is that when you work in developer client and server are on the same machine, but you are really creating a folder on the client side, which has nothing to do with the defaultFolder location.
Anyway, you don’t create a folder on the server, you upload a file (or files), giving it a location (or locations) which can contain subfolder paths, the plugin will then create the hierarchy for you.
As to the File plugin suddenly disappearing from the admin page, another user reported that to me, but I’m still puzzled to know what is happening.
When did this happen? What did you do exactly? What is your environment (OS/Servoy/Java)? Could you elaborate?
Thanks!
Thanks for the note.
When I changed the value of the file plugin property and restarted my developer, the property was not shown in the server plugin page.
One last question, where does custom plugins reside? Are they in client or remote(server-side)? If I create a folder or a file using a plug-in will it be created in the server?
erikd:
Thanks for the note.When I changed the value of the file plugin property and restarted my developer, the property was not shown in the server plugin page.
One last question, where does custom plugins reside? Are they in client or remote(server-side)? If I create a folder or a file using a plug-in will it be created in the server?
It depends on the type of plugin… an IClientPlugin is executed on the client side (which for the web client is actually server-side!), an IServerPlugin is always executed server-side.
The file plugin has now both (for a limited amount of methods).
So if you create a file it will be created on the client side (but note the special case of the web client).
And once again, you don’t create files on the server… you stream them.
Will have a look again at this property. Weird.
Ah ah! I found out what was the problem with the plugin property disappearing.
An exception was thrown because of a faulty test that was done on that folder to see if it was writable.
Will send a patch to correct this problem.
You can use the one attached until this is part of Servoy’s next update…
file.jar (64.1 KB)
Thanks for the update Patrick.
ptalbot:
It depends on the type of plugin… an IClientPlugin is executed on the client side (which for the web client is actually server-side!), an IServerPlugin is always executed server-side.
Do you have a tutorial on how to make an IServerPlugin Plugin?
I might write it one of these days, or maybe add that to the PRE-Conference Session Track III at ServoyWorld
You can try the tools plugin or the ftp plugin to work on the server. Both are free…
Ok, thanks.