|
楼主 |
发表于 2017-11-2 17:38:03
|
显示全部楼层
本帖最后由 developerML 于 2017-11-2 17:45 编辑
麻烦帮看一下我根据自己需求改的/UI2/system/api/native/image.js是否正确,黄色高亮是我改的,其他都没有改动
我理解upload方法的第一个参数是本地图片的存放路径,第二个是上传action的路径,如果我理解错误,请指点一下
uploadImage : function(param) {
if (window.cordova) {
var self = this;
var localId = param && param.localId;
if ((!localId)) {
Utils.errorCallback(self, param, {
'errMsg' : "uploadImage:fail",
'resultStr' : "localId missing !"
});
return;
}
;
//var filename = localId.substring(localId.lastIndexOf("/") + 1);
var filename ="菊花.jpg";
var successCallback = function(res) {
Utils.successCallback(self, param, {
'serverId' : JSON.stringify({
"ownerID" : device.uuid,
"storeFileName" : filename,
"realFileName" : filename
}),
'errMsg' : "uploadImagek"
});
};
var failCallback = function(res) {
Utils.errorCallback(self, param, {
'errMsg' : "uploadImage:fail",
'resultStr' : res
});
};
var ft = new FileTransfer();
var params = {};
params.fileName = filename;
params.storeFileName = filename;
params.ownerID = device.uuid;
//ft.upload(localId, location.origin + require.toUrl(base.config.uploadActionUrl), successCallback, failCallback, {
ft.upload("C:/Users/Public/Pictures/Sample Pictures/菊花.jpg", "/baas/x5/attachment/SimpleFileStore", successCallback, failCallback, {
"fileName" : filename,
"params" : params
})
}
},
|
|