Hi Roberto,
not sure what's not working for you on web client, can you tell us more?
[EDIT] Actually found out that there is something wrong when the file is coming from the web client showFileOpenDialog callback: it is a special type of JSFile (UploadData) which was not properly taken into account, will write a patch for this (hopefully) before 5.2.2.[/EDIT]
Roberto Blasco wrote:- Where the file goes in the server side?
if you have a look at the admin page of Servoy, in the plugins page, you will see that there is a new server property for the file plugin, which is called "servoy.FileServerService.defaultFolder", this is where you can set up the (server-side) root path that streamFilesToServer (and streamFilesFromServer) will use.
If you don't provide a path, the plugin will create an "/uploads/" folder in your "/Servoy/application_server/server/webapps/ROOT/" folder and use it as default. The files uploaded there will be directly accessible from a http url like
http://yourServerUrl/uploads/yourfileNote that this path is not secured so it is advised that you setup a path that will not be visible although it might be handy to use for public images and public files... it's really up to you.
Roberto Blasco wrote:- Can I say to the function the dirname of the server where to place the file?
Now, everything you upload will go in that folder, but note that you can use a second parameter to set up a path relative to that folder, like so:
- Code: Select all
plugins.file.streamFilesToServer( file, "/asubfolder/anotherone/" + file.getName(), callback_stream_file );
The relative path must always start with "/" if you use that second parameter.
Roberto Blasco wrote:- Is callback_stream_file() receiving any parameter?
The callback_stream_file will receive parameters:
- file (depending on the version of Servoy you use it can be a String (a path like "/folder/file.ext") - for 5.2 - or a JSFile - for 5.2.1)
- exception if any exception occured (in which case file will probably be null
So you callback_stream_file can be written like that:
- Code: Select all
function callback_stream_file( file, ex ) {
if (ex) {
// do something with the exception:
application.output( ex, LOGGINGLEVEL.ERROR) ;
} else {
application.output( file.getAbsolutePath() );
}
}
And in 5.2.2 you will also have a new JSProgressMonitor object that will give you some feedback about the transfers (both ways), allowing you to give feedback to your users