Skip to main content
Inspiring
January 10, 2019
Answered

Copy File from 1 Server to Another

  • January 10, 2019
  • 1 reply
  • 1018 views

I have an application that is on 2 servers where form data from server #1 populates and creates a fill-in PDF on server #2

Server #1  - Railo server  (Cant do PDF stuff)

Enter Info into Form  > Submit Form to Server #2

Server #2 -Windows server with CF16 on it

Gets form field info and creates a PDF.

Now I want that PDF to be copied back to server #1.

How can I do that?

Do I save it on server #2 and then do some file transfer or can I save it back to server #1?

    This topic has been closed for replies.
    Correct answer WolfShade

    I agree with Dave Watts​ on this one.  You could also use AJaX in a semi-sneaky way.

    Ex:  Replace the form submit button with a plain old regular button and use JavaScript to create an XHR (or use jQuery to $.post() the data) and submit to both servers (assuming server 1 retains the data in a database, or creates an email and sends it.)  Server 1 will retain/email the data, server 2 will use a CFC to create the PDF and return it to the user for downloading.

    OR, server 2 could create the PDF, return a message to the client that an email is on its way, and email the PDF to the user.

    V/r,

    ^ _ ^

    1 reply

    Community Expert
    January 10, 2019

    You're not going to be able to just save it back to server one the way you're describing it. But there's no reason why you couldn't capture the data on server one, have server one send that data to server two via CFHTTP and get back the PDF, then save it temporarily on server one and serve it back to the original user. Note that PDF generation is slooooow, so you'll have to build a process that takes this into account.

    Dave Watts, Eidolon LLC

    Dave Watts, Eidolon LLC
    WolfShade
    WolfShadeCorrect answer
    Legend
    January 11, 2019

    I agree with Dave Watts​ on this one.  You could also use AJaX in a semi-sneaky way.

    Ex:  Replace the form submit button with a plain old regular button and use JavaScript to create an XHR (or use jQuery to $.post() the data) and submit to both servers (assuming server 1 retains the data in a database, or creates an email and sends it.)  Server 1 will retain/email the data, server 2 will use a CFC to create the PDF and return it to the user for downloading.

    OR, server 2 could create the PDF, return a message to the client that an email is on its way, and email the PDF to the user.

    V/r,

    ^ _ ^

    weezerboyAuthor
    Inspiring
    January 11, 2019

    I created the email on server#2 and sent an email with the attachment to the user. Thank you