这个是浏览器嵌入wps的一段js代码 有没有办法写这个回调地址呢?实现将js中的文件二进制流获取并保存在服务器指定的地址上
/**
* @desc 将当前文档保存到指定路径的服务器上
* 注意: windows平台采用的上传不是表单上传,后台服务器需要参照upload_w.jsp来解析文件数据
* linux平台则采用标准的表单上传,后台服务器可以采用标准的表单处理逻辑
* @param { String } uploadURL 保存到服务器的路径
* @param { String } fileName 保存服务器指定文档名
* @returns { Bool } Windows平台为true或false
* { String } Linux平台为json类型字符串
*/
saveFileToSever: function(uploadURL, fileName) {
var ret;
if (undefined == fileName) {
fileName = 'defaultSave.wps';
}
if (isWindowsPlatform()) {
ret = this.pluginObj.saveURL(uploadURL, fileName);
} else {
var paramInfo = '{"fileName" :' + fileName + '}';
ret = this.SaveDocumentToServerForLinux(uploadURL, paramInfo);
}
return ret;
},
SaveDocumentToServerForLinux: function(URL, paramInfo) {
if (undefined == paramInfo || 0 == paramInfo.length) {
paramInfo = "{}";
}
return this.pluginObj.SaveDocumentToServer(URL, paramInfo);
},
SaveDocumentToServer: function(URL, paramInfo) {
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest();
xhr.open('POST', URL, true);
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
resolve(xhr.responseText);
} else {
reject(xhr.statusText);
}
}
};
xhr.send(paramInfo);
});
},