Login  
Search All Forums
Dart Home | PowerTCP Web Enterprise for ActiveX | Custom Development Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web Enterprise for ActiveX
Topic: WebASP file upload w/ other data
mhp

From: new york, NY USA
Posts: 47
Member Since: 04/24/02
posted April 26, 2002 11:53 AM

The WebASP makes file uploads a piece of cake, along with posting other data...

But if you just post variables and don't set any files to upload, it looks like the post is not done as a multipart post (which makes sense, since only data is going up)...

My question is, can you FORCE it to always use the multipart encoding? even if there are no files to post?

I saw someone say "if you can do it in IE, you can do it with PowerTCP", so the equivalent thing I'm trying to accomplish can be seen if you make a form in IE with a file input and in the form tag add the attribute

enctype="multipart/form-data"

that way, whether you supply a form or not, the post is always encoded the same way...
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted April 26, 2002 12:20 PM

Hi,
Sure, just use FilesToPost with the variables, as below.
-ken

  Dim vars As New DartStreams
  Dim v1 As New DartStream
  Dim v2 As New DartStream
  
  v1.Ref = "Name"
  v1.Write "Ken"
  vars.Add v1
  
  v2.Ref = "City"
  v2.Write "Rome"
  vars.Add v2
  
  WebASP1.Request.FilesToPost = vars
  WebASP1.Post

K M Drake
Dart Tech Support
mhp

From: new york, NY USA
Posts: 47
Member Since: 04/24/02
posted April 26, 2002 12:21 PM

wicked! thanks ken, and also thanks for the quick reply time..
mhp

From: new york, NY USA
Posts: 47
Member Since: 04/24/02
posted April 26, 2002 12:51 PM

The method you suggested does work by forcing the post to be encoded as multi-part but the content type of the variables is not the same if its done this way as it is from IE, and that tends to screw up the ASP side...

An example of a variable using the DartStream:
-------------------------------------4239816200214
Content-Disposition: form-data; name="foo"
Content-Type: application/octet-stream

bar

An example of a variable using the HttpVariable:
-------------------------------------4239816200214
Content-Disposition: form-data; name="foo"

bar

I guess I could just insert at least one dummy DartStream variable to force the post to multipart encoded, and leave all the regular non file variables as HttpVariables.... unless you know of a way to change the content-type of the dartstream part?
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted April 26, 2002 3:00 PM


Hi,
Is this a hypothetical question, or do you actually experience problems with the header included? In my experience, the presence of the header has not mattered.
You can always add the multipart header, and then create the body of the message yourself (using Body.Write).
-ken

K M Drake
Dart Tech Support
Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX