Fiddler add binary file data to POST

Oliver picture Oliver · Oct 6, 2011 · Viewed 21.4k times · Source

I'm try to add binary file data directly to the request body of a POST call so I can simulate a file upload. However, I tried setting a 'before request' breakpoint and using 'insert file' but I couldn't seem to get that to work. I also tried to modify CustomRules.js to inject the file but couldn't figure out how to load binary data via JScript. Is there an easy solution here?

Answer

ManicBlowfish picture ManicBlowfish · Sep 7, 2012

I'm sure this is a new feature in the year since this question was answered, but thought I'd add it anyhow:

There's a blue "[Upload file]" link in Composer now on the right side under the URL textbox. This will create a full multipart/form-data request. If you use this, you'll notice in the body you now have something that looks like this:

<@INCLUDE C:\Some\Path\my-image.jpg@>

In my case, I just wanted to POST the binary file directly with no multipart junk, so I just put the <@INCLUDE ... @> magic in the request body, and that sends the binary file as the body.