Hi!
Well, I see a couple of differences from what I know.
First of all, boundary is much longer in the packet that IE sends to WEB server. Another difference is that you add too many line breaks. There is not line break between starting boundary and binary data, as far as I remember.
Just for you information: If neded, I can send you a sample of HTTP packed data for multipart/data POST. I have an ASP application program that grabs the binary input from WEB server dusring multipart/data POST, parses it and stores binary fiel properly. I did not used any DLL for this. ASP is slow, so I get it to work only for files with length up to 2.5 MB. I can debug it and strip out the converted output so you will see a format used here.
>Having a problem with mixing binary-text data for an HTTP POST. If I use boot.ini as my file-to-send, it gets to the web server fine. If I use chimes.wav, it doesn't get there. :(
>
>Can anyone tell me how I should transform the bytes so they will send correctly? They always seem to get truncated after a few bytes. It doesn't seem to matter if I use cContent = FileToStr or cContent = CreateBinary(FileToStr ....
>
>
> vbCRLF = Chr(13)+Chr(10)
> Clear
>* cFile = 'c:\winnt\media\chimes.wav'
> cFile = "c:\boot.ini"
> cContent = FileToStr(cFile)
> ? Transform(Len(cContent))
> cAddr = 'http://127.0.0.1:8080/wteupload.asp'
> oHTTP = CreateObject('Msxml2.ServerXMLHTTP.4.0')
> oHTTP.Open( 'POST' , cAddr , .f. , 'testdom1\testdomuser1' , 'password' )
> cBoundary = '---AaB03x'
> oHTTP.SetRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' )
> oHTTP.SetRequestHeader( 'Content-Type', 'multipart/form-data, boundary=' + cBoundary )
> oHTTP.SetRequestHeader( 'Content-Length', Transform(Len(cContent)) )
> cBody = '--' + cBoundary + vbCRLF + ;
> 'Content-Disposition: form-data; name="thefile1"; filename='+(cFile)+'"'+ vbCRLF + ;
> 'Content-Type: image/gif' + vbCrLf + vbCRLF + ;
> cContent + vbCRLF +'--' + ;
> cBoundary + vbCRLF + ;
> 'Content-Disposition: form-data; name="submit1"' + vbCRLF + vbCRLF + ;
> 'Submit' + vbCRLF + vbCRLF + '--' + cBoundary + '--'
> oHTTP.Send(cBody)
> ? oHTTP.ResponseText
>
>
>I created a simple .ASP page using Soft Artistan's SA-FileUp to catch the upload. This works fine if I use either IE to do the upload or use the above code on a text file.
>
>Thanks, I am desperate!
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.