向 SAP 中的 OData 請求傳遞影像值時出錯
如果 ImgData 包含 base64 資料 URI 格式的影像,請將以下內容新增到 Imgvalue 以將之轉換為 ImgData
var imgData = JSON.stringify(ImgValue);
我建議你使用 AJAX 來發布影像,就像以下程式碼所示 OData
OData.request
({
requestUri:"http://test.test1.net:8081/sap/opu/odata/sap/ SALES_VRS/DailySalesSet",
method: "GET",
headers:
{
-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0",
"X-CSRF-Token":"Fetch"
}
},
function (data, response)
{
header_xcsrf_token = response.headers['x-csrf-token'];
csrftoken = header_xcsrf_token;
$.ajax({
url: 'http://test.test1.net:8081/sap/opu/odata/sap/ZPVSYSTEM_SRV/PromoImagesSet/',
//dataType: 'json',
data: imgData,
//data: image,
type: 'POST',
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "image/png",
"DataServiceVersion": "2.0",
/*"Accept": "application/atom+xml,application/atomsvc+xml,application/xml", */
"X-CSRF-Token": csrftoken,
"slug": slug,
},
success: function(data) {
debugger;
console.log(data);
},
error: function(data) {
debugger;
console.log(data);
}
});
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP