FormData

현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.

FormData 인터페이스는 XMLHttpRequest.send()로 쉽게 보내질 수 있는 폼 field와 그 값들로 나타나는 key/value쌍들을 쉽게 만들 수 있는 방법을 제공한다. 만약에 인코딩 타입이 "multipart/form-data"로 설정이 되어 있으면 폼이 사용하는 것과 같은 포맷으로 사용한다.

FormData 객체는 entries() 대신 for...of로 바로 사용되어 질 수 있다: for (var p of myFormData)는 (var p of myFormData.entries())와 같다.

Note: 이 기능은 Web Workers에서 가능하다.

생성자

FormData()
새로운 FormData 객체를 생성한다.

메소드

FormData.append()
FormData 객체안에 이미 키가 존재하면 그 키에 새로운 값을 추가하고, 키가 없으면 추가한다.
FormData.delete()
FormData 객체로 부터 key/value 쌍을 삭제한다.
FormData.entries()
Returns an iterator allowing to go through all key/value pairs contained in this object.
FormData.get()
Returns the first value associated with a given key from within a FormData object.
FormData.getAll()
Returns an array of all the values associated with a given key from within a FormData.
FormData.has()
Returns a boolean stating whether a FormData object contains a certain key/value pair.
FormData.keys()
Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
FormData.set()
Sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.
FormData.values()
Returns an iterator allowing to go through all values of the key/value pairs contained in this object.

Specifications

Specification Status Comment
XMLHttpRequest
The definition of 'FormData' in that specification.
Living Standard FormData defined in XHR spec

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Edge Opera Safari
Basic support 7.0 (Yes) 4.0 (2.0)[1] 10 (Yes) 12 5
append with filename (Yes) No support 22.0 (22.0) ? ? (Yes) ?
delete(), get(), getAll(), has(), set() 50.0 No support 39.0 (39.0) No support ? (Yes) No support
entries(), keys(), values(), and support of for...of 50.0 No support 44.0 (44.0) ? ? (Yes) No support
Available in web workers (Yes) (Yes) 39.0 (39.0) No support ? (Yes) No support
Feature Android Android Webview Edge Firefox Mobile (Gecko) Firefox OS (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support 3.0[2] (Yes)[2] (Yes) 4.0 (2.0)[1] 1.0.1 ? 12 ? (Yes)
append with filename ? (Yes) No support 22.0 (22.0) 1.2 ? ? ? (Yes)
delete(), get(), getAll(), has(), set() (Yes) 50.0 No support No support No support No support No support No support 50.0
entries(), keys(), values(), and support of for...of ? 50.0 No support 44.0 (44.0) 2.5 ? ? ? 50.0
Available in web workers (Yes) (Yes) (Yes) (Yes) (Yes) No support (Yes) No support (Yes)

[1] Prior to Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), if you specified a Blob as the data to append to the object, the filename reported in the "Content-Disposition" HTTP header was an empty string; this resulted in errors being reported by some servers. Starting from Gecko 7.0, the filename "blob" is sent.

[2] XHR in Android 4.0 sends empty content for FormData with blob.

See also

문서 태그 및 공헌자

 이 페이지의 공헌자: HanHyeoksu
 최종 변경: HanHyeoksu,