1

I'm using blueimp/jQuery-File-Upload to allow users to upload attachments when creating a inquiry on my site.

I need to extend the current functionality to add a auto generated image to the queue. The image I need to add is an exported canvas, thus a base64 encoded string, i.e something like

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNby // blAAAADElEQVQImWNgoBMAAABpAAFEI8ARAAAAAElFTkSuQmCC

How can I add such a file to the upload queue? I am stuck and don't know where to start. Any pointers to the right direction is much appreciated.

2
  • you mean to say set image file?i doubt its possible because of security reasons Commented Jun 29, 2016 at 7:04
  • @guradio Not sure what you mean but probably. So the only way would be to pass it to my back end in a separate post or something? I failed to mention that it's not supposed to end up on my servers but on amazon S3. Commented Jun 29, 2016 at 7:11

1 Answer 1

1

It is not possible to programmatically add a File object to FileList object at <input type="file"> element. You can create a file as data URI; Blob or File; or FormData object, use POST to send file object to server.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! That's what I feared.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.