Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 1190 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Good afternoon,

I have a script running on the server (Server 2019 Standard) that generates a CSV file that I then place into a container field.
Whilst I can do this on my local workstation with Get(TemporaryPath), then Insert File into a field, when I try to run it on FMS the file is created in a temporary folder but both the file and the folder are deleted immediately the moment the script closes.  I stop writing to the CSV file.  I have intercepted it and see that the file is being created OK though.

I thought perhaps it may have been Windows Defender, but might it also be FMS deleting it?  FMP on my workstation doesn't delete it immediately afterwards.

Anybody know why this maybe happening and if there is a workaround?

Thankyou,
Greg

 

Posted

I am confused by your question. Your title says "Insert File" on Server. The Insert File script step is not available on FMS. But then you say that the problem is the file being deleted "the moment the script closes". I would have thought that both actions are performed by the same script - so why would that be a problem?

If you want to perform this on the server and use the temporary folder, then both actions MUST be performed by the same script, because:

Quote

 In server-side scripts, each script runs in its own session; once the script is completed, the session terminates and the temporary folder is deleted.

If you're looking for alternatives to the Insert File script step that will run server-side, then consider either insert from URL or using a plugin. The Base Elements plugin has a BE_FileImport function and I believe ScriptMaster and MBS also have equivalents.

 

 

Posted

Good evening Comment.

The title was about achieving the Insert File script step on the server as I know that command is not supported on that platform.
Perhaps to clarify, I was running a PSOS from my workstation that generates the CSV text and writes it to a temporary directory (on the server) but for some strange reason as soon as I Close File, the file disappeared.  It is most peculiar.
It was also suggested to me to not use Get(TemporaryPath) but Get(DocumentsPath) instead - which works fine. I'm thinking it's more a Windows thing than Filemaker.

I will also be looking at the BaseElements and MBS plugins for other file manipulation tools.

Once again - thankyou for your help.  :)  Greg

Posted
1 minute ago, Greg Hains said:

I'm thinking it's more a Windows thing than Filemaker.

I doubt that. If the file really disappears after you close it while the script itself continues, then I would say it is a bug.

3 minutes ago, Greg Hains said:

I was running a PSOS from my workstation that generates the CSV text and writes it to a temporary directory (

So I understand you are writing the CSV file yourself, not exporting it as I thought. In such case, why don't you simply insert it into the container field directly using the TextEncode() function, instead of going through the OS file system? 

 

Posted

As far as I understand it files in the temporary folder are deleted when the FM session quits. So FM desktop will delete them on exit - it used to be a bug pre-FM14 when it failed to delete temporary files.

When you run PSOS this firstly invokes an FM session on the server and then executes the script. When the script finishes then the FM session on the server is also quit, thereby deleting the file. I know because I tested it.

The desktop folder does not behave like this and any file written there will remain on either desktop or server.

Posted
3 hours ago, IdealData said:

The desktop folder does not behave like this and any file written there will remain on either desktop or server.

I think you meant the Documents folder. And yes, any file written there will remain until you remove it yourself - which is why OP would do well to try and resolve the temp folder issue before turning to workarounds.

 

This topic is 1190 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.