nugawiki

./categories/front-end

axios FormData POST 전송

업데이트 2026-07-21 조회수

FormData

const form = new FormData()
form.append('id', userID)
form.append('pwd', userPass)

axios.post('/api/auth', form)
  .then(res => console.log(res))
  .catch(err => console.error(err))

querystring

import qs from 'querystring' // 또는 qs 패키지

axios.post('/user/login', qs.stringify({ id, pw }))
  .then(data => { /* ... */ })

axios.post(url, { headers, id, pwd })처럼 body에 headers를 넣으면 FormData가 아님.

./comments