0
다음은 이미지를 서버로 전송하는 데 사용한 제 기능입니다. http url을 사용하고 있었는데 이제는 https url에서 예외가 발생합니다. 나는 cordova 파일 전송 플러그인이 http 만이고 https는 지원하지 않기 때문에 생각합니다. 다른 사람이 그것에 의존하기 때문에 어느 누구도 https에서이 작업을 할 수 있습니까?HTTPS를 사용하는 Cordova 플러그인 파일 전송
public uploadImg(img, userId) {
/*if (credentials.email === null || credentials.password === null || credentials.name === null) {
return Observable.throw("Please insert credentials");
} else {*/
// At this point store the credentials to your backend!
console.log(userId);
let options: FileUploadOptions = {
fileKey: 'img',
fileName: 'name.png',
params: {action: 'upload_image', api_key: API_KEY, user_id: userId},
httpMethod: 'post',
mimeType: 'image/png'
}
console.log('upload function');
return new Promise(resolve => {
this.fileTransfer.upload(img, encodeURI('https://pehlayzindagi.pk/api/api.php'), options)
.then((data) => {
console.log('uploaded image');
console.log('APi response is' + data.response);
let img = JSON.parse(data.response);
console.log(img.status + ' ' + img.message);
resolve(img)
// success
}, (err) => {
console.log('image failed');
reject(false)
// error
});
});
// } }
감사