0

lets say, I have my files in variable files.

Normally I send a JSON Object to my server:

let person = {
 name = 'alan'
 job = 'it'
};

And then I send with axios post.

So how can I add the attached file to the object and send it to the server? Because on server-side and in db I need to know which file belongs to which person?

1 Answer 1

3

You can use Base64 encode in client side and add the encoded string to your post request and decode from server side.

1
  • So then I can just add another string atribute to my person object and assign the string to it, thats all?
    – farahm
    Commented Feb 4, 2020 at 14:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.