2017-09-13 102 views
0

我正在使用fileTransfer插件在我的ionic 2應用程序中上傳簽名。要捕獲簽名,我正在使用angular2-signaturepad無法使用`fileTransfer`插件在離子中將簽名上傳到遠程服務器,但在本地服務器上正常工作

let options: FileUploadOptions = { 
    fileKey: 'file', 
    fileName: 'Order_'+this.order_data.order_id+"_"+this.order_data.order_type+".png", 
    headers: {}, 
}; 
fileTransfer.upload(this.signaturePad.toDataURL(), 
this.api+'php/wd_upload.php?location=signs', options) 
    .then((data) => { 
     // success 
    }, (err) => { 
     // error 
    }); 

上述代碼在本地服務器上正常工作,簽名成功上傳。但是當我試圖改變這個API來引用遠程服務器。此文件傳輸失敗,出現以下錯誤

body: "<head><title>Not Acceptable!</title></head><body><h1>Not Acceptable!</h1><p>An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.</p></body></html>" 
code: 1 
exception: "http://<remote_server>/php/wd_upload.php?location=signs" 
http_status: 406 
source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADICAYAAABS39xVAAAYsElEQVR4Xu2dXXBVVZbHd4QmCfMyScq ...." 
target: "http://<remote_server>/php/wd_upload.php?location=signs" 

請解決此問題?

回答

0

一切正常,當我更換option如下

let options: FileUploadOptions = { 
    fileKey: 'file', 
    fileName: 'Order_'+this.order_data.order_id+"_"+this.order_data.order_type+".png", 
    httpMethod : 'POST', 
    mimeType: 'image/png', 
    chunkedMode: false, 
    headers : {"Accept": "image/png"} 
    }; 
相關問題