Hi all,
I reference this http://www.jappit.com/blog/2010/02/0...ing-apibridge/ to write a widget that first take a photo ,and then upload it to the server.
My code is:
function init(){
function photoCaptureSuccess(photoSource){
if (photoSource && photoSource.length) {
document.getElementById('captured_photo').src = photoSource;
APIBridge.fileUpload(
"photo",
photoSource,
"http:xxx.php",
null,
function(res) {
alert("Done");
},
function(res) {
alert("fileUpload ERROR: " + res.status);
}
);
}
else {
alert("No image taken...");
}
};
function photoCaptureError(ajaxReq){
alert("Error " + ajaxReq.status);
};
function takePhoto(){
APIBridge.newFileService(APIBridge.NewFileType.Image, photoCaptureSuccess, photoCaptureError);
}
document.getElementById('capture_button').addEventListener('click', takePhoto, false);
}
The Problem is : Only once can I uoload a photo ,the second time it failed with ERROR: 500.
But when I restart my device(N97) or reinstall the sis file ,It can upload a photo again(but ony once ) .
Any one knows how to solve the problem?
Thanks very much

Reply With Quote

