Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to send a form with binary data to another server?

Reply
Thread Tools

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

 
 
ij
Guest
Posts: n/a
 
      11-26-2003
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


 
Reply With Quote
 
 
 
 
Roji. P. Thomas
Guest
Posts: n/a
 
      11-26-2003
you to specify the enctype property of the form to
"multipart/formdata"

--
Roji. P. Thomas
SQL Server Programmer
________________________
"ij" <ok> wrote in message
news:3fc4898a$0$13681$(E-Mail Removed) 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Re: How can i send 8-bit data or binary data with pyserial? Fredrik Lundh Python 1 12-15-2004 10:24 PM
How can i send 8-bit data or binary data with pyserial? ouz as Python 1 12-14-2004 12:31 PM
How can i send 8-bit data or binary data with pyserial? ouz as Python 3 12-13-2004 01:55 PM
How to send a form with binary data to another server? ij ASP General 0 11-28-2003 01:50 PM



Advertisments