1

i have created a form to make a submission to an api using axios. There are 3 other parameters and then the files to submit.

I got it working with one file but what I need to do is be able to have multiple files uploaded and then submit, i tried using the multiple flag but this seems to only allow you to select multiple files in the same folder at once rather than choosing and selecting the files individually.

I don’t want the files sent to the api until the submit button is clicked though.

I thought maybe about using local storage to put the files and then pull to submit at once when the button is clicked?

Tamsin
  • 21
  • 1
  • 2
  • I suggest read [this](https://hacks.mozilla.org/2012/02/saving-images-and-files-in-localstorage/) how saving things works – SC Kim Jun 12 '20 at 11:06
  • Have you tried to use multiple input fields? Also you might want to checkout vue-croppa component to preview, crop and have more control on events. – Aleksey Razbakov Jun 12 '20 at 11:24
  • 1
    Have you read this one? No localStorage required. https://stackoverflow.com/questions/47119426/how-to-set-file-objects-and-length-property-at-filelist-object-where-the-files-a/47172409#47172409 – v-moe Jun 12 '20 at 11:40

1 Answers1

0

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

mai elrefaey
  • 394
  • 1
  • 3
  • 10