Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use FormData() for uploading a file? #7

Closed
sadeqsafaeian opened this issue Sep 5, 2019 · 1 comment
Closed

How to use FormData() for uploading a file? #7

sadeqsafaeian opened this issue Sep 5, 2019 · 1 comment

Comments

@sadeqsafaeian
Copy link

How to use FormData() for uploading a file?

  <div class="form-group">
      <div class="col-md-8 col-md-offset-4">
        <button type="submit" class="btn btn-primary">Submit</button>
      </div>
    </div>
 return new Promise((resolve, reject) => {
      axios.post(Config.apiPath + 'post', form,{headers: { 'Content-Type': 'multipart/form-data'}})
        .then(
          response => {
            commit('STORE_POST_OK', response.data.post)
            resolve()
          })
        .catch(error => {
          commit('STORE_POST_FAIL')
          reject(error.response.data)
        })

How I use FormData()?

let formData = new FormData();
 formData.append('file', this.form.file);
@vedmant
Copy link
Owner

vedmant commented Sep 5, 2019

It's not related to this project. Just google it http://letmegooglethat.com/?q=How+to+use+FormData()+for+uploading+a+file

@vedmant vedmant closed this as completed Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants