Skip to content

Upload a PDF file #83

@Tes3awy

Description

@Tes3awy

Hello there,

I am trying to use this awesome plugin to upload a PDF file. I have created a model for this:

import Model from './Model';

export default class JobApplication extends Model {
  resource() {
    return 'v2/job_applications';
  }
}

Then, I call the model within the .vue file like that:

...
 import JobApplication from "./../models/JobApplication";
...
async onSubmit() {
  let job = new JobApplication({
    first_name,
    last_name,
    email,
    mobile_phone,
    resume: this.$refs.resume.files[0]
  });
  await job
    .save()
    .then(response => {
      console.log(response);
    })
    .catch(error => {
      console.error(error.response);
    });
}
...

The problem is that the POST request fails every time I try to submit the form because of the resume field. What am I doing wrong in here? Do I have to do any extra steps? Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions