Client -> Server 파일 전송
- https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/How_the_Web_works#so_what_happens_exactly (✅)
- Clinet → Server로 요청을 날리면 원래 파일들(index.html, style.css, and etc)이 Response로 왔었다 JSON 형태가 아니라… 그리고 이러한 response는 수천가지의 packet으로 쪼개져서 온다.
- Sending and Receiving Binary Data
- 파일들을 여러 가지 형태로 읽을 수 있다. 그것을 XHR에서 지정을 해줄 수도 있고. 예를 들어 서버에서 .png 파일을 보내준다고 치면 XHR responseType을 arraybuffer, blob 등으로 지정을 하여서 파일을 원하는 형태로 받을 수 있음
- XMLHttpRequest: send() method
- send 메쏘드는 서버에 request를 보내주는 녀석인데 이 녀석은 다양한 형태의 parameter를 받는다. 이 형태중 하나가 FormData이다.
- Form DataThe FormData interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".formData가, XHR 에 사용될 수 있구나
- .Using FormData Objects
- formData 타입의 객체를 사용하여서 어떻게 XHR request를 날릴 수 있는지 보여준다