cretueusebiu / vform

Handle Laravel-Vue forms and validation with ease.
https://vform.vercel.app
MIT License
610 stars 122 forks source link

uploading pdf file or doc with crud function not working #93

Closed usmanbasharmal123 closed 4 years ago

usmanbasharmal123 commented 4 years ago

I am trying to upload a pdf or doc file edit it again and delete function but I could not find the way if you could help me with

leonardomrl commented 4 years ago

@usmanbasharmal123 https://www.npmjs.com/package/object-to-formdata

import { objectToFormData } from 'object-to-formdata';

methods: {
    save () {
      this.form.post('/essays', {
        transformRequest: [function (data, headers) {
          return objectToFormData(data)
        }],
        onUploadProgress: (e) => {
        }
      })
        .then((result) => {
         console.log("Ok")
        })
    },
}

Example : https://github.com/cretueusebiu/vform/blob/master/example/upload.html