Post file from server to another server - Urgent help required

B

Badri Narayanan

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
 
B

Bullschmidt

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

Badri Narayanan

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top