Am trying to import documents from an folder on the server into container field. I have started on this script, but not quite there yet, somebody some idea of how to do this ?
Server can't see outside of Get(DocumentsPath) and Get(TemporaryPath), so if you want to insert a file from another location, you have to move the files there, or use Insert From URL instead.
Also, if you note the documentation:
Insert File is not compatible as a FileMaker Server Scheduled step, and WebDirect only has partial support (can not specify source file by variable).
Insert From URL is probably the way for you to go. It requires the "file:" URL protocol:
file URI scheme - Wikipedia, the free encyclopedia
So maybe something like this on windows:
"file:///c:/Users/ServerUser/Desktop/testimport/faktura/" & $FilePath & "/" & $FileName
I tested it, PSOS need removing slashes as
and Get(DesktopPath) returns "/C:/Windows/System32/config/systemprofile/Desktop" for default system account.
Also testet it, but even if the folder has an document it would not go to the else. How would I be able to set the name of the file in the folder ?
Where are you setting '$FileName'?
how can I set $FileName
Set Variable ( $FileName ; "<<your name here >>" )
Getting an error saying that file dont exist, and there is a pdf-file in the folder:
You can't "Insert File" on PSOS, use "Insert from URL".
Why do you use Get(Filename) ? This returns database file name. If you want to put PDF, set its name.
If you want to put many files from a folder, you need get file names using os shell script or plug-in.
If you use MBS Plugins, you can use various commands to import on server:
The path must be a native path, e.g. /tmp/test.png
Am just trying locally on my computer first, so then I can use insert file I believe? to do this on the file system on a server I need to use insert from url. The $FileName need to be a variable, since we cant know what the filename is at this point. Im planing to move the file imported to another folder somehow in the end of this script, so the files dont get imported more than once. How would you get this filename to the variable ?
If I cant use some of the filemaker functions, I would need this. How do I install this plugin?
Retrieving data ...