Post file from server to another server - Urgent help required

Discussion in 'ASP General' started by Badri Narayanan, Mar 30, 2005.

  1. I accept a few user inputs and a file from the user, post it to my ASP page.
    I'm able to receive the data as well as the file properly in Receiver.asp.
    In my receiver.asp, I need to process the user inputs and subsequently POST
    this data and the file again to a different server. I would like to use
    ServerXMLHttp. Now, how do I simulate Form creation in receiver.asp.

    I use the following code to post to the second server
    MyXmlHttp.open "post", myTargetURL,false
    MyXmlHttp.setRequestHeader "Content-Type", "multipart/form-data"

    Now here's where I get stuck.
    1) How do I construct the form data? How can I put together the data i
    received (which is text) as well as the received file (which is Binary) in
    the same Send statement for the Post? -- I assume that if HTML forms do it in
    some format, I should be able to simulate the same through ASP, but how???

    2) The received file will not be stored anywhere in my server. It has to
    be forwarded in memory.

    Should it look somewhat like the following?
    MyXmlHttp.send ("userId=" & someUserId & "&privateLabelID=" & someLabel &
    "&File=" & receivedBinaryFileInMemory)

    Thanks in advance for any help
    Badri Narayanan, Mar 30, 2005
    #1
    1. Advertising

  2. Badri Narayanan

    Sean Guest

    Can you show the code in Receiver.asp so we can help you?

    Sean

    "Badri Narayanan" <> wrote in
    message news:...
    >I accept a few user inputs and a file from the user, post it to my ASP
    >page.
    > I'm able to receive the data as well as the file properly in Receiver.asp.
    > In my receiver.asp, I need to process the user inputs and subsequently
    > POST
    > this data and the file again to a different server. I would like to use
    > ServerXMLHttp. Now, how do I simulate Form creation in receiver.asp.
    >
    > I use the following code to post to the second server
    > MyXmlHttp.open "post", myTargetURL,false
    > MyXmlHttp.setRequestHeader "Content-Type", "multipart/form-data"
    >
    > Now here's where I get stuck.
    > 1) How do I construct the form data? How can I put together the data i
    > received (which is text) as well as the received file (which is Binary) in
    > the same Send statement for the Post? -- I assume that if HTML forms do it
    > in
    > some format, I should be able to simulate the same through ASP, but how???
    >
    > 2) The received file will not be stored anywhere in my server. It has to
    > be forwarded in memory.
    >
    > Should it look somewhat like the following?
    > MyXmlHttp.send ("userId=" & someUserId & "&privateLabelID=" & someLabel &
    > "&File=" & receivedBinaryFileInMemory)
    >
    > Thanks in advance for any help
    >
    >
    Sean, Mar 31, 2005
    #2
    1. Advertising

  3. Sean... thanks for your time and interest. We've cracked it.
    Badri
    "Sean" <> wrote in message
    news:RGM2e.859356$8l.658155@pd7tw1no...
    > Can you show the code in Receiver.asp so we can help you?
    >
    > Sean
    >
    > "Badri Narayanan" <> wrote in
    > message news:...
    > >I accept a few user inputs and a file from the user, post it to my ASP
    > >page.
    > > I'm able to receive the data as well as the file properly in

    Receiver.asp.
    > > In my receiver.asp, I need to process the user inputs and subsequently
    > > POST
    > > this data and the file again to a different server. I would like to use
    > > ServerXMLHttp. Now, how do I simulate Form creation in receiver.asp.
    > >
    > > I use the following code to post to the second server
    > > MyXmlHttp.open "post", myTargetURL,false
    > > MyXmlHttp.setRequestHeader "Content-Type", "multipart/form-data"
    > >
    > > Now here's where I get stuck.
    > > 1) How do I construct the form data? How can I put together the data i
    > > received (which is text) as well as the received file (which is Binary)

    in
    > > the same Send statement for the Post? -- I assume that if HTML forms do

    it
    > > in
    > > some format, I should be able to simulate the same through ASP, but

    how???
    > >
    > > 2) The received file will not be stored anywhere in my server. It has

    to
    > > be forwarded in memory.
    > >
    > > Should it look somewhat like the following?
    > > MyXmlHttp.send ("userId=" & someUserId & "&privateLabelID=" & someLabel

    &
    > > "&File=" & receivedBinaryFileInMemory)
    > >
    > > Thanks in advance for any help
    > >
    > >

    >
    >
    Badri Narayanan, Mar 31, 2005
    #3
  4. Badri Narayanan

    Bullschmidt Guest

    <<
    I accept a few user inputs and a file from the user, post it to my ASP
    page.
    I'm able to receive the data as well as the file properly in
    Receiver.asp.
    In my receiver.asp, I need to process the user inputs and subsequently
    POST
    this data and the file again to a different server.
    >>


    To submit a form is a client-side thing to do.

    You could have a page with a bunch of hidden fields filled with info
    that immediately gets submitted with JavaScript like this toward the
    bottom of the page:

    <script type='text/javascript'>document.myform.submit();</script>

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    http://www.Bullschmidt.com
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex http://www.developersdex.com ***
    Bullschmidt, Mar 31, 2005
    #4
  5. Thanks for the reply...

    As I have mentioned in my post, I need to process some data and the file
    input by the user, add my own stuff to the form, and post it to a different
    domain. The requirement is that all this processing has to happen at the
    server side only. If it is only data (which is just text and no file
    attached), this works to perfection using ServerXMLHttp . I was trying to
    figure out how this can be achieved with data as well as an attached File in
    the Form. The "file attachment" makes the entire Form data to be binary.

    While I think I have worked out a solution, I think there are other issues
    that I need to comprehend. I'm currently putting it all together

    Thanks
    Badri

    "Bullschmidt" <-nospam> wrote in message
    news:...
    > <<
    > I accept a few user inputs and a file from the user, post it to my ASP
    > page.
    > I'm able to receive the data as well as the file properly in
    > Receiver.asp.
    > In my receiver.asp, I need to process the user inputs and subsequently
    > POST
    > this data and the file again to a different server.
    > >>

    >
    > To submit a form is a client-side thing to do.
    >
    > You could have a page with a bunch of hidden fields filled with info
    > that immediately gets submitted with JavaScript like this toward the
    > bottom of the page:
    >
    > <script type='text/javascript'>document.myform.submit();</script>
    >
    > Best regards,
    > J. Paul Schmidt, Freelance ASP Web Developer
    > http://www.Bullschmidt.com
    > ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    Badri Narayanan, Mar 31, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dinesh Upare

    help required urgent

    Dinesh Upare, Aug 13, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,005
    Carl Prothman [MVP]
    Aug 13, 2003
  2. Replies:
    1
    Views:
    503
    kameshwar_kaushik
    Jan 29, 2006
  3. Vishal
    Replies:
    1
    Views:
    662
    Steve C. Orr [MVP, MCSD]
    Dec 21, 2004
  4. Just D.
    Replies:
    0
    Views:
    446
    Just D.
    Mar 10, 2006
  5. Zev Blut
    Replies:
    10
    Views:
    177
    Zev Blut
    Feb 23, 2005
Loading...

Share This Page