Unable to upload image from Cordova to web server - No idea why

  • Hi All.

    I have installed Quasar and Cordova, I am totally unable to upload an image to my webserver.

    Here is my code:

    sendReport: function () {
          let formData = new FormData();
          formData.append('type', this.type);
          formData.append('siteimage', this.picturePath);
          api.post('/addreport', formData, { headers: { 'content-type': 'multipart/form-data' } })
            .then((response) => {
              this.$store.dispatch('alerts/alertGreen', 'Your report has been sent', {
                root: true
            .catch(error => {
              if (error.response.status < 500) {
                this.$store.dispatch('alerts/alertRed', 'There is a problem, please tryin again', {
                  root: true
              } else {
                this.$store.dispatch('alerts/alertRed', 'There is something wrong with our server, please try again later', {
                  root: true

    In the chrome console, I get everything sent properly as:

    type: land
    siteimage: file:///storage/emulated/0/Android/data/com.ken.mobile/cache/1560461815392.jpg

    On the web server side(Laravel), I get:

    {"siteimage":["The siteimage must be an image.","The siteimage must be a file of type: jpeg, png, jpg."]}

    It is like my server script does not recognise this image. Is this something to do with Cordova itself?

    I saw a lot of people using a file transfer plugin(which is now deprecated), is there a way to do the exact same thing with Axios or is it not possible?

    Thank you

Log in to reply