3

I'm creating some performance tests for a web application that sends requests of the same type that a browser would send to our server. One of these requests is a POST that uploads an image. I looked at this question where it looks like the actual contents of the image file should be inside the body of the request. However when I use F12 dev tools in Chrome to inspect what the browser sends in the request it looks like this:

  ------WebKitFormBoundaryjHN86sGb89n2HUZOT
  Content-Disposition: form-data; name="profileImg[]"; filename="bmp.bmp"
  Content-Type: image/bmp


  ------WebKitFormBoundaryjHN86sGb89n2HUZOT--

The space where I expected to see the file contents is blank. I was expecting to see some string of seemingly random characters representing the contents of the image file. There's also no path to the image in the request, only the name of the file, so I can't understand exactly how the file could be uploaded? Is Chrome just hiding the data from me?

Étienne
  • 4,131
  • 2
  • 27
  • 49
EJS
  • 861
  • 4
  • 11
  • 25
  • 1
    Perhaps Chrome is hiding the data from you to make things more readable? Not sure. The path to the image won't be in the request any more, though, for [security reasons.](http://stackoverflow.com/questions/15201071/how-to-get-full-path-of-selected-file-on-change-of-input-type-file-using-jav) – Pekka Dec 09 '15 at 09:09
  • Did you create a New Bitmap File from the Explorer context menu? That generates a file of 0 bytes. – CodeCaster Dec 09 '15 at 09:10
  • @CodeCaster No I'm using a screenshot saved in bmp format of about 840KB. – EJS Dec 09 '15 at 09:39
  • I marked https://stackoverflow.com/questions/55743964/how-to-see-form-data-with-enctype-multipart-form-data-in-chrome-debugger?noredirect=1#comment103429069_55743964 and https://stackoverflow.com/questions/55743964/how-to-see-form-data-with-enctype-multipart-form-data-in-chrome-debugger?noredirect=1#comment103429069_55743964 as duplicate of this question. – Étienne Oct 25 '19 at 08:38
  • It seems reasonable to mark this as a duplicate. My question https://stackoverflow.com/q/54409184/500902 presents different information but it is clearly the same issue. (It also seems a misguided implementation - yes I could submit an issue - a small POST of multipart/form-data is hidden whileh a LARGE one of text/xml is not.) – Marvin Oct 25 '19 at 14:11

2 Answers2

4

Chrome hides the file data, when viewing the request payload using dev tools, for performance reasons:

https://groups.google.com/forum/#!topic/google-chrome-developer-tools/FaInquBDhU0

Jeb
  • 12,898
  • 6
  • 31
  • 36
  • See also https://bugs.chromium.org/p/chromium/issues/detail?id=1019710&q=multipart%2Fform-data&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified – Étienne Jan 28 '20 at 16:27
2

So I downloaded Fiddler and it actually shows that there is data being sent where we in Chrome see only a blank space. This means that Chrome does indeed hide the data.

EJS
  • 861
  • 4
  • 11
  • 25