alessiomaffeis / vue-picture-input

Mobile-friendly picture file input component for Vue.js 2-3 with image preview, drag and drop, EXIF orientation, and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to POST image using axios

ankush981 opened this issue · comments

Hello,

I'm not having much success sending the image data as POST using axios and this plugin. Here's what my request looks like:

this.axios.post(
    this.getApiBaseUrl + '/partners/' + this.getPartnerId + '/basic-details', 
    {
         profile_photo: this.$refs.profilePic.image,
    }
);

At the backend, the profile_photo variable arrives as a string, and not as a file object. Any help will be much appreciated!

In that particular format, perhaps?: data:[mediatype][;base64],

https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs

Thank you! I didn't know this was a Data URI. 👍

Was using it before and deal with it too :)
Your welcome