Closed heyypatrick closed 4 years ago
Invalid server URL
states that the server URL is invalid for some reason.
With the server URL obfuscated we cannot really say why that might be.
Double check that your server url is valid. Are you able to use API via another developer tool such as postman
?
Invalid server URL
states that the server URL is invalid for some reason.With the server URL obfuscated we cannot really say why that might be.
Double check that your server url is valid. Are you able to use API via another developer tool such as
postman
?
The server URL is valid because it's working on Android. One of the thing that makes it harder is that it doesn't return any error on the server. It returns ERROR CODE = 2
which means INVALID_URL_ERR
but works well Android.
the second parameter of upload should use encodeURI(), for example:
fileTransferObj.upload(fileObj.file_path, encodeURI(uploadURL), options).then((res) => { observer.next(res); }, (err) => { this.toast.showToast(err, 2000); }).catch((e) => {});
see docs
the second parameter of upload should use encodeURI(), for example:
fileTransferObj.upload(fileObj.file_path, encodeURI(uploadURL), options).then((res) => { observer.next(res); }, (err) => { this.toast.showToast(err, 2000); }).catch((e) => {});
see docs
Wow! It's almost a year and I'm still stuck in this problem. Had to work on a workaround to fix this issue. I will surely try this one thank you, @johnjackson !
Bug Report
fileTransfer.upload(...) returns an error with a DATA_URL destinationType. Works well with Android.
Problem
I've been working on an upload function but fileTransfer.upload(...) returns an error when attempting to upload an image using an API.
What is expected to happen?
Upload data with image successfully to a remote server.
What does actually happen?
File Transfer Error: Invalid server URL ENDPOINT [696:88559] FileTransferError { code = 2; source = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAYAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAFAKADAAQAAAABAAADwAAAAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQA...
Information
I'm using this with Ionic 5.
Command or Code
` .this.camera.getPicture(cameraOptions).then((imageData) => {
Environment, Platform, Device
Testing on iPad mini 2 with iOS version 12.3.1.
Version information
Checklist