470,594 Members | 1,442 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

How to send a form with binary data to another server?

ij
Hi,

I'm trying to submit an image object, along with some other text fields to
another web server from within an ASP page but am stuck on getting the image
to be submitted with the form.

In a bit more detail:
1. When this particular page is executed, I want the server to pull an image
from a db (stored as a BLOB) along with a few other text fields. This part
is easy and I have no problems with it.
2. I want to submit the image, along with the text fields to a second
webserver which typically accepts its input from a form (ie, the second
webserver usually has a webpage where a user enters some information into
form and browse for a file. When clicking submit, the form fields along with
the file are submitted to the second server).

The reason for this is that I'm trying to migrate from one web based photo
album to another which uses a data structure that is complicated and
difficult to interface with, so I'm using the web based image upload
functionality of the new album.

Doing the above steps without the image / BLOB is fairly easy, and I have
successfully migrated the album info across using the code at the end of
this message.

The problem is doing the same but also submitting a BLOB.
I'm extremely stuck and any help would be very much appriciated.

Cheers,
Kent

Code:

strSQL = "SELECT Name, Description, Date, Owner_ID, id, category_id,
Parent_Album FROM photo_album WHERE ID =" + Request.QueryString("id") + ";"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.CommandTimeout = 120
objConn.ConnectionTimeout = 120
objConn.Open strConn
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorLocation = 3
objRS.Open strSQL,objConn,2,2,1

if cint(objRS.fields("Parent_Album")) = 0 then
url = baseUrl & "cmd=new-album&protocol_version=2.1&set_albumName=" &
objRS.fields("category_id")
else
url = baseUrl & "cmd=new-album&protocol_version=2.1&set_albumName=" &
objRS.fields("Parent_Album")
end if
url = url & "&newAlbumName=" & objRS.fields("id")
url = url & "&newAlbumTitle=" & objRS.fields("Name")
url = url & "&newAlbumDesc=" & objRS.fields("date") &
objRS.fields("Description")
response.write(url)
response.write("<br><br>")

objXmlHttp.open "GET", url, False
objXmlHttp.send
Jul 19 '05 #1
1 3899
you to specify the enctype property of the form to
"multipart/formdata"

--
Roji. P. Thomas
SQL Server Programmer ;)
________________________
"ij" <ok> wrote in message
news:3f***********************@news.optusnet.com.a u...
Hi,

I'm trying to submit an image object, along with some other text fields to
another web server from within an ASP page but am stuck on getting the image to be submitted with the form.

In a bit more detail:
1. When this particular page is executed, I want the server to pull an image from a db (stored as a BLOB) along with a few other text fields. This part
is easy and I have no problems with it.
2. I want to submit the image, along with the text fields to a second
webserver which typically accepts its input from a form (ie, the second
webserver usually has a webpage where a user enters some information into
form and browse for a file. When clicking submit, the form fields along with the file are submitted to the second server).

The reason for this is that I'm trying to migrate from one web based photo
album to another which uses a data structure that is complicated and
difficult to interface with, so I'm using the web based image upload
functionality of the new album.

Doing the above steps without the image / BLOB is fairly easy, and I have
successfully migrated the album info across using the code at the end of
this message.

The problem is doing the same but also submitting a BLOB.
I'm extremely stuck and any help would be very much appriciated.

Cheers,
Kent

Code:

strSQL = "SELECT Name, Description, Date, Owner_ID, id, category_id,
Parent_Album FROM photo_album WHERE ID =" + Request.QueryString("id") + ";" Set objConn = Server.CreateObject("ADODB.Connection")
objConn.CommandTimeout = 120
objConn.ConnectionTimeout = 120
objConn.Open strConn
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorLocation = 3
objRS.Open strSQL,objConn,2,2,1

if cint(objRS.fields("Parent_Album")) = 0 then
url = baseUrl & "cmd=new-album&protocol_version=2.1&set_albumName=" &
objRS.fields("category_id")
else
url = baseUrl & "cmd=new-album&protocol_version=2.1&set_albumName=" &
objRS.fields("Parent_Album")
end if
url = url & "&newAlbumName=" & objRS.fields("id")
url = url & "&newAlbumTitle=" & objRS.fields("Name")
url = url & "&newAlbumDesc=" & objRS.fields("date") &
objRS.fields("Description")
response.write(url)
response.write("<br><br>")

objXmlHttp.open "GET", url, False
objXmlHttp.send

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Lisa Pearlson | last post: by
2 posts views Thread by Fatih BOY | last post: by
9 posts views Thread by eswanson | last post: by
2 posts views Thread by Slim | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.