我想将转换和映像转换为base64格式,然后将其上传到服务器上,但是base64字符串太大,以至于我在网上发现错误,没有收到参数。没有想法将完整的字符串发送到服务器使用在webservice下面?以下是我尝试过的服务。
var xhrAddclient = Titanium.Network.createHTTPClient();
xhrAddclient.open('POST', webservice_url);
xhrAddclient.send({
method : "addclient",
image : base64string,
});
xhrAddclient.setTimeout(10000);
xhrAddclient.onerror = function() {
showAlertBox('Service timed out. Please try again.');
};
xhrAddclient.onload = function() {
showAlertBox("Client added successfully.");
};
答案 0 :(得分:0)
点击此处:http://www.smokycogs.com/blog/titanium-tutorial-how-to-upload-a-file-to-a-server/
或只是:
xhr.setRequestHeader("Content-type", "multipart/form-data");
xhr.send(file);