I'm trying to save a blob image into sqlite (Web SQL) on an Apache Cordova App which is run on Android.
I've figured out how to create the blob and obtain it from a local file. The problem is that on the database, instead of being saved the blob, saves an String which states [Object Blob]
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","http://localhost/image.jpg",true);
xmlhttp.responseType = 'blob';
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState==4){
var product_image = xmlhttp.response;
db.transaction(tx.executeSql("INSERT INTO scans(product_image) VALUES (?)",[product_image]), errorCB);
}
}
xmlhttp.send();
In fact, product_image returns a jpeg blob object. But as stated before, when I do SELECT the result returns [Object Blob]
This is how I create the database:
CREATE TABLE IF NOT EXISTS scans(id INTEGER PRIMARY KEY, product_image BLOB)
Aucun commentaire:
Enregistrer un commentaire