13 Replies Latest reply on Feb 25, 2008 1:56 PM by cputnam14

    CFFILE with multipule servers

    cputnam14
      Hello,
      Here is my problem. I have 2 servers both running cold fusion. These servers are set up on a load balancer that directs traffic. My program lets a user upload a logo, but I need the upload to go to both servers. At the moment, it will only write the file to the server that the load balancer sent them too. I've tried using using 2 CFFILE tags with both destinations, but that throws an error telling me that the other destination is invalid. Any idea how to get around this problem?
      Thanks
        • 1. Re: CFFILE with multipule servers
          Steve Sommers Level 4
          Put the uploaded logo in a database table. Search this forum for "database image" or google "coldfusion database image" and you'll find various threads on the topic. It's very simple, especially if you are using MX7 or 8.
          • 2. Re: CFFILE with multipule servers
            cputnam14 Level 1
            That's what I am doing. I write the file name to a database and use that to show the image. Problem is, I don't know which server the load balancer will send the user to. So when they upload the logo, it displays half the time. Am I missing something?
            • 3. Re: CFFILE with multipule servers
              Steve Sommers Level 4
              No, you don't just write the file name to the database, you write the entire file contents to the database.
              • 5. Re: CFFILE with multipule servers
                cputnam14 Level 1
                Do you know for sure this will work using sql server 2000. I've been trying now for a little while, and I think my data types don't match.
                • 6. Re: CFFILE with multipule servers
                  Steve Sommers Level 4
                  Yes - both methods work with SQL Server 2000.
                  • 7. Re: CFFILE with multipule servers
                    cputnam14 Level 1
                    sweet...got it to work. I had to set my data type to image instead of binary. Thanks so much.
                    • 8. Re: CFFILE with multipule servers
                      Level 7
                      > sweet...got it to work. I had to set my data type to image instead of binary. Thanks so much.

                      This is a really awful solution if the logo needs to be served up on a
                      regular basis. Just because one CAN store a file in a DB doesn't mean one
                      SHOULD. Files belong in the file system. You're much better off storing
                      your logo as a file.

                      With your original CFFILE issue, you have to realise the file ops are being
                      called by the login account that CF uses to start its service, as and that
                      user is - by default - either "localsys" or "nobody". Those users
                      generrally don't have access to resources on remote boxes. If you need the
                      CF server to have access to a remote box, you need to start it as a user
                      that has permissions to said box.

                      --
                      Adam
                      • 9. CFFILE with multipule servers
                        Steve Sommers Level 4
                        quote:

                        Originally posted by: Newsgroup UserThis is a really awful solution if the logo needs to be served up on a regular basis. Just because one CAN store a file in a DB doesn't mean one SHOULD. Files belong in the file system. You're much better off storing your logo as a file.
                        I fully agree with your statement that just because you CAN...doesn't mean you should BUT there is not enough information in this thread to come to the conclusion that this is an awful solution.

                        The only known fact is that multiple servers are being used with load balancing. It is not know if these logos are regularly served so the overhead associated with this process may be moot. The size of the images are not known -- if they are small, query caching can be used to compensate for the speed difference between a "real file" vs. a "database file."

                        Is a third-party hosting provider being used? If so, most will not allow access to a shared server like you describe (at least not without a heafty setup and monthly fee).

                        Finally, this shared directory you describe must be in the DMZ or you'll have to open up your internal firewall policies to allow the access -- both options have raise security concerns.

                        Bottom line: Is is the best solution -- I don't know. But based on the information available in this thread, I don't see how you can know either.
                        • 10. Re: CFFILE with multipule servers
                          Steve Sommers Level 4
                          Sorry, I just reread your post and I see you did qualify your statement: "This is a really awful solution if the logo needs to be served up on a regular basis."

                          Please ignore my rant.
                          • 11. Re: CFFILE with multipule servers
                            Level 7
                            > Sorry, I just reread your post and I see you did qualify your statement: "This is a really awful solution if the logo needs to be served up on a regular basis."
                            >
                            > Please ignore my rant.

                            I think your response was valid and makes some good points.

                            There's no such thing as *too much* advice.

                            --
                            Adam
                            • 12. CFFILE with multipule servers
                              Steve Sommers Level 4
                              I was thinking about this a little further and there is no reason why these two concepts couldn't be made into a hybrid model to get the best of both worlds.

                              Upload the file to a local directory. Upon upload, store the file into a table with name, size and date/time information. LEAVE the file available for use. When the image is requested, check and query the table for the file header info. If you have a local copy and the header info agrees, simply send the file. If not, grab the file out of the table, save it and now send it.

                              This way, files will be available to both (or more) servers but the actual serving of the files will come from a local copy of the file.
                              • 13. Re: CFFILE with multipule servers
                                cputnam14 Level 1
                                I was able to manage to upload to both of my servers. I had to change the coldfusion services on each machine to run using an account that had rights to both servers. Once I did that, I used 2 <cffile> tags. For the destination, I put one servers ip, then the other servers ip for the other. Everything works like a charm now.
                                Thanks for the help.