There are a couple of ways to approach this. But it's not as simple as, "Insert file in container field".
1) You can write a batch script to copy an externally-stored container to the destination and run it on a schedule (either through the FileMaker Server scheduler or some other scheduling tool).
2) You can use Insert From URL and assemble a POST request to upload the asset directly using some variant of the PHP code to do so (basics of how to do so available here).
Caveat: You'll need to mind security with any such scheme, to prevent malicious file uploads. Some of it you can do through the FileMaker interface (by restricting file extensions, for example), and you should additionally scrub the files per the PHP instructions to make certain users can't upload files that can damage your server or web site.
Thank you for your advice. Unfotuantely, this would need to be on way too frequent a basis for me to run it as a server side scheduled script and as for the PHP method, I think that may be TOO complicated for where the program is.
However, I was looking around on the FileMaker website and found that you can change the directory that FileMaker is programmed to store the data in and can specify your own path under File > Manage > Containers. Unfortunately, when I open the window, I'm locked out of using any of the functionality.
First, is this a viable option for what I'm trying to do?
Second, any idea why I am locked out? I'm using a Full Access account and the website says that's all that is required in order to add directories. Is it because the file is hosted and there are other users currently active?
Well, if you run your schedule every minute, I don’t see why it wouldn’t work …
Theoretically, yes, you could redirect the path for the externally stored assets. You’d have to be careful about the permissions, but this might work. (I haven’t tried it myself.) And you absolutely MUST never, under any circumstances, allow anything else - user or program - to touch those assets in any way other than “read only" other than FileMaker in any way other than “read only". If you do, the containers will interpret the contents has having been tampered with and you’ll lose the connection. There were, however, some demonstrations of using this capability to “get around” the limitation on Export Field Contents at DevCon this year, so it’s at least theoretically possible.
As to why you can’t change the path with it hosted, the answer is yes, it’s because it’s hosted. When the file is first loaded to server, the path is set. So to be completely safe, you’ll probably have to take the database offline, download it to a local drive, (maybe) convert it to internal storage (not sure on that one), reset the path, and then upload it to Server again.
Just a suggestion: you have your path set on the server. Offer a script that would return this path to the local machine. This way you can make sure the text is transmitted. Also you dont need it to be global.
Re: "convert it to internal storage (not sure on that one)"
I don't think that should be necessary. You can specify your own path with external storage, but as you note, you'd need to be set permissions correctly so that FMS can access the location you specify. Personally, I think it is preferable to let FM manage the storage.
Yeah, thanks. I wasn’t sure.
I recalled this morning that the demo I saw at DevCon involved redirecting the containers to the Documents directory, so FMS could access them for import. That way, users could drop, say, an Excel spreadsheet into a container and have a PSoS script import them. Having the containers stored in the wwwroot is new to me.