I am working on a project written in VB6 where I need to upload a PDF to a server over HTTP. The file must be posted as multipart/form-data. For some reason, when the file gets transmitted, it is getting corrupted. I have verified that the binary data is correct immediately before I post to the server. After I post, some of the binary data is different and the PDF will not display properly. I am using ServerXMLHTTP to post the file. I have included my code, the original PDF (PDF-Before.pdf), the form data that I am posting (PostData-Before.txt), the form data that gets received by the server (PostData-After.txt), and the resulting PDF file (PDF-After.pdf). If I compare the before and after files using WinDiff, there are a few sections that are different in the binary data. It is always the same parts that are different. I would greatly appreciate your assistance with this.
Dim objHTTP As ServerXMLHTTP40
Set objHTTP = New MSXML2.ServerXMLHTTP40
Call objHTTP.Open("POST", strURL, False)
Call objHTTP.setRequestHeader("Content-Type", "multipart/form-data; boundary=---------------------------7d83cf5800be")