@javelez9 wrote:
Hi. I have a very strange problem with @ionic-native/file-transfer in ionic 3. in Android the upload works very well, but in iOS it doesn’t work, when I send the request nothing happens, neither a 200 or any other response.
This is my code
public doSelectPhotoImage (sourceType:number, uploadURL:string) { const options: CameraOptions = { quality : 80, destinationType : this.camera.DestinationType.FILE_URI, sourceType : sourceType, // this.camera.PictureSourceType.CAMERA encodingType : this.camera.EncodingType.JPEG, mediaType : this.camera.MediaType.PICTURE } this.camera.getPicture(options).then((imagePath) => { // Special handling for Android library if (this.isPlatformAndroid()) { if (sourceType !== this.camera.PictureSourceType.CAMERA) { this.filePath.resolveNativePath(imagePath) .then(filePath => { this.sendFileAndData(filePath, uploadURL, {}); }); } else { this.sendFileAndData(imagePath, uploadURL, {}); } } if (this.isPlatformIOS()) { this.sendFileAndData(normalizeURL(imagePath), uploadURL, {}); } else { this.sendFileAndData(imagePath, uploadURL, {}); } }, (err) => { console.log(err); }); } public sendFileAndData (fileURL:string, uploadURL:string, params) { console.log("fileURL=" + fileURL); let options: FileUploadOptions = { fileKey: "fileParamName", chunkedMode: false, params: params }; this.cordovaFileTransfer.upload(fileURL, uploadURL, options).then( (result) => { console.log("Result: " + result); }, (err) => { console.log("ERROR: " + err); } ).catch((err) => { console.log("ERR: " + err); }); }
Nothing is printed in the console.
I also have read and follow the instructions in this article without success:
I have uninstalled and re-installed the plugin and the dependencies of file-transfer, also re-installed all the project dependencies, but the result is the same.
I have tested in the emulator and in a real device, iPhone 6 with iOS 11.
ionic-info:
I have spent 2 weeks without success, any help will be very appreciated.
Thanks in advance!
Posts: 1
Participants: 1