FileDocumentFromFile java call - syntax for arguments
I am trying write a file (on my local computer) into a System.fileDocument within a Microflow. I am using the communitycommons FileDocumentFromFile java call. There are 2 arguments: (a) file - for this I have a string eg 'C:\Users\ray\Desktop\sample.doc' and (b) fileDocument - for this I have a System.FileDocument object name eg $LibraryDocs. This causes an error at run time. I am happy that the System.FileDocument value is OK as I use this successfully to write other data, but I am not sure about the correct syntax for the file ? Any assistance gratefully received. Edit-Solution Finally solved it - there are certain directories where access is allowed eg (%PROJECTDEPLOYMENTDIR%/data/tmp/). placing my files in a subdirectory below means they are accessible and can be written to the System.fileDocument.
You could check your stacktrace but the problem is that because of security risks you are not allowed to write to your C drive unless it is the regular temp dir. So you are allowed to write to C:\tmp but not to any other C path.
Just to clarify. If you want to write a file from Mendix to your local harddisk this can only be done to the tmp path. But reading a file so it becomes a filedocument in Mendix should not be a problem. Only just make sure that you do not write directly to system.Filedocument but to an entity which inherits from system.Filedocument. And make sure that you have set the security right on this object otherwise you still end up with I/O errors.