Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
ciiko
Posts: 30
Registered: ‎06-14-2012
My Device: 9810
My Carrier: Telkomsel

How to send base64 encode(string) to a remote server???

Hi all, 

I tried send the JPG base64 encode(string) to server, But I always stuck, hope somebody can help me

Please use plain text.
Contributor
Developer4IIL
Posts: 13
Registered: ‎03-06-2012
My Device: 9930, 9900
My Carrier: -

Re: How to send base64 encode(string) to a remote server???

var

xmlhttp = new XMLHttpRequest();

function

PostToServer(server_url, basestring) {

 

varobjJSON = JSON.stringify({ Base64: basestring });

xmlhttp.open(

'POST', server_url, true);

xmlhttp.setRequestHeader(

'Content-Type', 'application/json; charset=utf-8');

xmlhttp.setRequestHeader(

'Content-Length', objJSON.length);

xmlhttp.onreadystatechange =

function() {

 

if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {

 

//Complete

}

};

xmlhttp.send(objJSON);

}

 

 // Please Mark as Solved

Please use plain text.