[英]image doesn't send to serveur from ionic3
我嘗試將多個圖像從ionic3上傳到serveur php,但是我有錯誤圖像沒有發送到后端。.我使用imagepicker插件來選擇多個圖像..
代碼角度:
testfile(){
for (var l of this.images)
{
if(l !== 'K' && l !== 'O')
{
this.base64.encodeFile(l).then((base64File: string) => {
var formData = new FormData();
formData.append('photo',base64File);
this.http.post('url api',formData, {responseType: 'text'}).subscribe(res =>
alert(res),
err => {
this.presentToast(err);
});
}
, (err) => {
this.presentToast(err);
this.presentToast('error encode');
});
}
}
}
我也嘗試發送不附加到formData的base64File,也嘗試發送l(循環獲取),但在所有情況下都出錯
嘗試使用相機插件並進行設置
Camera.PictureSourceType: PHOTOLIBRARY
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.