Hi all. Currently, I have a setup where I use an HTML form to send 3 files to a server and then download the server response. I am trying to do this without using the form, but don't get the correct response from the server. The response that I do get back identifies an issue with the files ie the files are not be sent correctly. Has anyone used the MSXML2.XMLHTTP method to send files to a server? If so, any help in identifying issues with my code below will be greatly appreciated. Below is the code for the HTML form as well as the QTP code.

ps - Mods, please let me know if this question is best suited for a forum other than QTP and I will move it over. Thanks


<font class="small">Code:</font><hr /><pre>

&lt;FORM METHOD="POST" ACTION= MYURL enctype="multipart/form-data"&gt;
File1: &lt;INPUT TYPE="file" NAME="MyFile1"&gt;&lt;br&gt;
File2: &lt;INPUT TYPE="file" NAME="MyFile2"&gt;&lt;br&gt;
File3: &lt;INPUT TYPE="file" NAME="MyFile3"&gt;&lt;br&gt;
&lt;INPUT TYPE="SUBMIT" VALUE="Submit"&gt;&lt;/FORM&gt; </pre><hr />

QTP Code

<font class="small">Code:</font><hr /><pre>

Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.open "POST", MYURL, false
objHTTP.setRequestHeader "enctype", "multipart/form-data"
objHTTP.Send ("MyFile1=C:\TestFile1.xml&amp;MyFile2=C:\TestFile 2.xml&amp;MyFile3=C:\TestFile3.txt")
Msgbox objHTTP.responseText </pre><hr />