0
我想將圖像發佈到我的grails應用程序,而且我沒有太多的運氣。Titanium Studio to Grails imge post
我的二碼爲:
function upload(){
var xhr = Titanium.Network.createHTTPClient();
xhr.onerror = function(e){
Ti.API.info(picMedia + " : " +message.value);
Ti.API.info('IN ERROR ' + e.error);
alert('Sorry, we could not upload your photo! Please try again.');
};
xhr.onload = function(){
Ti.API.info('IN ONLOAD ' + this.status + ' readyState ' + this.readyState);
};
xhr.onsendstream = function(e){
Ti.API.info('ONSENDSTREAM - PROGRESS: ' + e.progress);
};
// open the client
xhr.open('POST', 'http://localhost:8080/FYP/Profile/appUploader');
// send the data
xhr.send({
media: picMedia,
message: message.value,
});
}
我Grails的代碼如下:從移動應用程序和錯誤在web應用中的「如果」行
def appUploader(){
println "MEDAI PARAMS: " + params.media
def f = request.getFile('media') ;
println "HERE: " + f
if (request.getFile(params.media).getOriginalFilename()) {
println "FROM APP: " + request.getFile('myFile').getOriginalFilename()
return
}
}
即時得到錯誤。 我在做什麼錯?
你需要發佈你得到的錯誤 – doelleri 2013-02-19 22:56:58
如果你嘗試通過ajax上傳文件,你會有一段糟糕的時間。 – 2013-02-20 01:14:48
你確定你在使用'multipart/form-data'內容類型嗎? – 2013-02-20 03:07:37