Forum Discussion
17 years ago
I tried to use the method of attaching a file to a HTTP request; it all looks nice there is just one problem:
The HTTP handler receiving the file written in .NET expects the attachment in the HttpContext.Request.Files collection.
Using fiddler I found out that the content disposition has to include the file name, otherwise it does not show in the collection. Comparing the two raw requests it simply lacks the additional information to work as intended. The desired missing part of the disposition is marked in red.
Is there any way to persuade SoapUI to add missing part in the content disposition?
---
POST https://[s:2u1won7j]URL[/s:2u1won7j] HTTP/1.1
Content-Type: multipart/form-data; boundary="----=_Part_1_29909270.1251199087858"
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.1
Host: [s:2u1won7j]URL[/s:2u1won7j]
Content-Length: 4460984
------=_Part_1_29909270.1251199087858
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="TransferToken"
c3517df3-53a5-49f2-8700-57b3ddcec952
------=_Part_1_29909270.1251199087858
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="MyBinaryFile.EXE" filename="FileName.Exe"
The HTTP handler receiving the file written in .NET expects the attachment in the HttpContext.Request.Files collection.
Using fiddler I found out that the content disposition has to include the file name, otherwise it does not show in the collection. Comparing the two raw requests it simply lacks the additional information to work as intended. The desired missing part of the disposition is marked in red.
Is there any way to persuade SoapUI to add missing part in the content disposition?
---
POST https://[s:2u1won7j]URL[/s:2u1won7j] HTTP/1.1
Content-Type: multipart/form-data; boundary="----=_Part_1_29909270.1251199087858"
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.1
Host: [s:2u1won7j]URL[/s:2u1won7j]
Content-Length: 4460984
------=_Part_1_29909270.1251199087858
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="TransferToken"
c3517df3-53a5-49f2-8700-57b3ddcec952
------=_Part_1_29909270.1251199087858
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="MyBinaryFile.EXE" filename="FileName.Exe"