• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFFILE with multipule servers

Explorer ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

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
TOPICS
Advanced techniques

Views

801

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

No, you don't just write the file name to the database, you write the entire file contents to the database.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

Here is a link to a Ben Forta blog entry that helped me:

http://www.forta.com/blog/index.cfm?mode=entry&entry=A61BC976-3048-80A9-EF7AE4D7D8F602B9

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

Yes - both methods work with SQL Server 2000.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

sweet...got it to work. I had to set my data type to image instead of binary. Thanks so much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

> 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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

> 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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 14, 2008 Feb 14, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 25, 2008 Feb 25, 2008

Copy link to clipboard

Copied

LATEST
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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation