--- tags: [file] title: file uploader --- ```javascript const formData = new FormData() formData.append('image', evt.target.files[0]) formData.append('directory', '/users') const data = { formData, token: this.$cookies().get('auth').access_token } const img = await this.uploadImage(data) evt.target.value = '' ``` [參考文章](https://happyjayxin.medium.com/%E4%BD%BF%E7%94%A8-javascript-formdata-%E5%82%B3%E9%80%81%E8%B3%87%E6%96%99-4b11bc6c3f83)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up