I'm trying to submit a form with a blob appended to one of the hidden input tags like so.
<form method="POST" action="api/save/image">
<input id="p_id" type="hidden" name="p_id" value=""/>
<input id="image" type="hidden" name="image" value=""/>
<button type="submit">Save Photo</button>
</form>
And my Javascript looks something like this.
$(document).ready(function(){
$('#p_id').val("444666"); //set hidden input
var croppedPhoto = $('#crop_stage').cropper('getCroppedCanvas');
croppedPhoto.toBlob(function (blob) {
$('#image').val(blob); //set blob to form hidden input
}
});
My issue is that I am unable to submit this because the blob isn't getting saved to the hidden field, instead it's the value [object Blob].
How do I append my blob so it can be submitted to the server?
Also please note that I am not able to use formData(); since I have to support IE8/IE9.
Thank you for your help.