I have code for upload image from camera to server (LOCAL) and it's work normally
fileTransfer.upload(imageData, 'http://192.168.0.100/profile/upload', options1).then((data) => {
// success
alert("Success");
}, (err) => {
// error
alert("error"+JSON.stringify(err));
});
and then I change the URL from local to hosting, but I get error like this
error {"code":3, "source":"file:///storage/...","target":http://mylink.com/profile/upload,"http_status":null,"body":null,"exception":"unexpected end of stream on com.android.okhttp_Address@51fa1429"
how to fix that?
add chunkedMode: false
in options. and code like this
let options1: FileUploadOptions = {
mimeType: 'multipart/form-data',
httpMethod: 'POST',
chunkedMode: false,
fileKey: 'file'
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments