1

Is there any way to insert a blob to an input file? I have on my website an input file where the user uploads a image. Then a preview of his image is display on my website, and the customer can edit this image. That image is a canvas that i convert then to blob.

So i need to insert this blob to the same input file where the customer has upload his file. Is there any solution for this? Hope you can help me!

Hien Nguyen
  • 24,551
  • 7
  • 52
  • 62
  • I'm not sure it's possible to manipulate the actual binary data assigned to an `` as the [`FileList`](https://developer.mozilla.org/en-US/docs/Web/API/FileList) is immutable. You can however append your modified data to a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object and submit that via AJAX – Phil Apr 30 '19 at 02:48
  • But indeed, @Phil is correct, all you need is `FormData.append(yourInput.name, yourBlob, yourInput.files[0].name)` and send your request through AJAX. – Kaiido Apr 30 '19 at 02:59

0 Answers0