I'm using the below codes for converting the base64 to blob
function base64tofile(base64){
var mime = base64.split(';base64,')[0].split('data:')[1];
var base64 = base64.split(';base64,')[1];
mime = mime || '';
var sliceSize = 1024;
var byteChars = window.atob(base64);
var byteArrays = [];
for (var offset = 0, len = byteChars.length; offset < len; offset += sliceSize) {
var slice = byteChars.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
return new Blob(byteArrays, {type: mime});
}
basically, I browse to an input file then convert to base64 after that, I have some image manipulation (camanjs, crop, etc..) processes then as an output will be base64 then convert to blob and upload to server using ajax.
Is it possible to put the blob back to the input file? so then using form I can submit the data to server without using ajax or js, just the native form submit.