We are currently re factoring our solution to allow users to use the web client, this is our first experience of web client coding so im a little lost as to the differences in what we can and cant use.
Currently we have a module which allows users to upload images, which are then renamed and stored on disk on the server.
the only thing you can do is first let the users upload the files by calling the plugins.file.showFileOpenDialog() (you have to specify the call back function)
Then when the users have selected 1 or more file to upload, those are being uploaded and when that is done your callback function will be called with a JSFile array of the uploaded files
For that you can ask the name/bytes/contenttype and store them on the server or db.
If the user can specify a directory on the server, you could first ask for that dir, then remember that and then call showFileOpenDialog()
So the user has uploaded a file and I have the JSFile Array returned to my callback function.
Is that file now physically present on the server or in memory?
And if in memory
Am I correct in thinking that I now need to write that file to the server using plugins.file.writeFile ?
Also where do the files get uploaded to? The default upload directory ?
they are in memory or cached onto a tmp dir if they are bigger then a certain size.
You then should write the files to disk on the server by using writeFile (or stream)
They are not uploaded to a default upload dir, only a tmp dir could be used.
to use writeFile() you have to do something like:
var myuploadedfile = callbackarray[0];
var serverfile = plugins.file.createFile("path/on/server");
plugins.file.writeFile(serverfile,myuploadedfile.getBytes());