| Dart Home | PowerTCP Web for ActiveX | Custom Development | Reply | PowerTCP Web for ActiveX Topics | Forums |
| Author | Forum: PowerTCP Web for ActiveX Topic: Dartstrings value truncating string |
| User597 Posts: 3 Member Since: 08/03/01 |
posted January 10, 2003 1:28 PM I am using the code below to post Excel files to my web server. As I step through the code, when I execute the statement "value.Add s", I can see that s holds the contents of my file. However, when I add value(1) to my poststring, this now only holds the first 8 bytes of s. I have downloaded the latest update.exe and installed it, but I am still getting nothing here. Needless to say my files are corrupt once uploaded. Please help! Here is code demonstrating multipart file upload (the previous post shows multipart post of a string): Option Explicit Const URL = "" Const FILE = "" Private Sub Command1_Click() Dim result As String Dim postString As String Dim reqH As New DartStrings Dim respH As New DartStrings Dim value As New DartStrings Dim name As New DartStrings Dim x As Integer Dim boundary As String ' Add Multipart Header boundary = "-----------------------------7d02e53b03d8" reqH.Add "Content-Type: multipart/form-data; boundary=" & boundary & vbCrLf ' Read File as Stream Dim s As String Dim stream As New DartStream Dim l As Long stream.FileMode = createExisting stream.FileName = FILE l = stream.Read(s) 'Add Values and Names value.Add s name.Add "FILE1" ' 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: text/plain" & vbCrLf & vbCrLf postString = postString & value(x) & vbCrLf Next x postString = postString & boundary & "--" & vbCrLf ' Post Http1.URL = URL Http1.Post postString, reqH, result, respH End Sub |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted January 10, 2003 1:51 PM Hi, If you see the same problem with the Multi-part Post Sample that ships with the latest Toolkit, please send an offending file to support@dart.com, and I will try to reproduce the problem. Thanks, -ken |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted January 10, 2003 2:00 PM s probably has a CRLF at position 8 and since the default delimiter for a DartStrings is CRLF it is being treated as 2 (possibly more) strings. Try setting delimiter to "" before doing the add. |
| User597 Posts: 3 Member Since: 08/03/01 |
posted January 10, 2003 4:34 PM Tony, It was the delimiter, when I change the delimiter it works. Thanks. (I wonder why it is just now failing when it used to work?) |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted January 10, 2003 4:39 PM I'm sorry, but I do not have an answer for that, but I am glad to hear that it works now! |
| Reply | PowerTCP Web for ActiveX Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|