Login  
Search All Forums
Dart Home | PowerTCP Web for ActiveX | Custom Development Reply | PowerTCP Web for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web for ActiveX
Topic: multipart POST EXAMPLE WHERE DID IT GO?
User200

Posts: 23
Member Since: 09/09/01
posted March 9, 2002 4:21 PM

I know there was one here at one time, I used it and it works! But I just tried to find it and it's gone. I am using the web tool to do a multipart/form-data post that includes the contents of a file

This is what I have working

  reqH.Add "Content-Type: multipart/form-data; boundary=" & boundary & vbCrLf
  reqH.Add "X-Xray: Does This Show?" & vbCrLf
  
  ' Add the prepend to the boundary
  boundary = "--" & boundary
  
  ' Read File as Stream
  Dim s As String
  Dim stream As New DartStream
  Dim l As Long
 
  stream.FileMode = createExisting
  stream.Filename = versionFile
  l = stream.Read(s)
  
  'Add Values and Names
  value.Add s
  Name.Add "versionFile"

  ' Create PostString
  postString = ""
  For x = 1 To Name.Count
   postString = postString & boundary & vbCrLf
   postString = postString & "Content-Disposition: form-data; name=""" & Name(x) & """" & "; filename=""" & stream.Filename & """" & vbCrLf
   postString = postString & "Content-type: " & contentType & vbCrLf & vbCrLf
   postString = postString & value(x) & vbCrLf
  Next x
  
  
  ' Add Username
  postString = postString & boundary & vbCrLf
  postString = postString & "Content-Disposition: form-data; name=""" & "LLUsername" & """" & vbCrLf & vbCrLf
  postString = postString & LLUsername & vbCrLf
  
  ' Add Password
  postString = postString & boundary & vbCrLf
  postString = postString & "Content-Disposition: form-data; name=""" & "LLPassword" & """" & vbCrLf & vbCrLf
  postString = postString & LLPassword & vbCrLf
  
  ' Add the formData
  For x = 1 To formData.Count
    postString = postString & formData(x)
  Next x
  
  postString = postString & boundary & "--" & vbCrLf

  ' Post
  mvarHttp1.URL = URL
  mvarHttp1.Post postString, reqH, result, respH
  
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted March 11, 2002 5:54 PM


Hi,
See:
http://support.dart.com/forum.dwp?view=2291#FID2291
and the response to that post for file uploads.
-ken

K M Drake
Dart Tech Support
User200

Posts: 23
Member Since: 09/09/01
posted March 11, 2002 6:11 PM

Thanks I will bookmark it.
Reply | PowerTCP Web for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX