6 Replies Latest reply on Nov 6, 2014 2:30 AM by Mike_Mitchell

    Storing a global on an external server?

    nsmith9110@gmail.com

      For a program I am working on, I have downloaded a web editor to communicate html text back into FileMaker. I am going to be using this for email functionality and in order to insert pictures, videos, etc. in to the email, you MUST have a web URL to enter.

       

      So, in order to get images to be able to be used in the emails, I have tried to set up a global field that they can use on their local computer where, when they put their media into the field, it will save it to the root folder for the website and generate the URL for them be able to insert into the email.

       

      However, the gloabl I have set up SAYS that it successfully transfers the file but I then can't find it anywhere, least of all in the folder that I need it to be in.

       

      Can anyone offer advice?

       

      If this isn't clear enough, I basically need to know how to save an image OFF OF a local host ONTO my server and have it saved in the root folder for the website.

       

      If you need more clarification let me know.

       

      Thank you

        • 1. Re: Storing a global on an external server?
          Mike_Mitchell

          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.

           

          HTH

           

          Mike

          • 2. Re: Storing a global on an external server?
            nsmith9110@gmail.com

            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?

            • 3. Re: Storing a global on an external server?
              Mike_Mitchell

              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.

              • 4. Re: Storing a global on an external server?
                samermb

                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.

                 

                cheers,

                Sam

                • 5. Re: Storing a global on an external server?
                  keywords

                  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.

                  • 6. Re: Storing a global on an external server?
                    Mike_Mitchell

                    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.