Ionic 3 camera fileupload

Need help how to work the fileupload using camera i been trying to solve this 2 weeks now with no luck.

Anyone care to help?

private fromGallery(): void {

this.camera.getPicture({
  sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
  // destinationType: this.camera.DestinationType.FILE_URI,
  quality: 100,
  // allowEdit: true
}).then(imageData => {
  // this.user_photo = "data:image/jpeg;base64,"+imageData;
  this.uploadPhoto(imageData);
}, error => {
  console.log(JSON.stringify(error));
});

}

uploadPhoto(imageData: any)
{

this.showLoading('Please wait...');
const filetransfer : FileTransferObject = this.transfer.create();

let options : FileUploadOptions = {
  fileKey : 'fileToUpload',
  fileName : 'name.jpg',
  // chunkedMode: false,
  // mimeType: "multipart/form-data",
  headers:{ Connection: "close"},
  // httpMethod : 'post',
}

filetransfer.upload(imageData, 'https://192.168.1.11/api/resumes/uploadthumbnailtest', options).then( (data) => {
  this.showError("success : " +JSON.stringify(data));
  this.loading.dismiss();
},(err) => {

  this.showError("err : " +JSON.stringify(err));
  this.loading.dismiss();

});

}

PHP

function uploadthumbnailtest() {

	$this->autoRender = false;
	$fileElementName = 'fileToUpload';
	$error = "";
	$msg = "";
	$filename = $file_name = "";
	header('Access-Control-Allow-Origin: *');
	header('Access-Control-Allow-Methods: GET, PUT, POST');            
	header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization"); 
	
	echo json_encode(array("result"=>"success"));
	exit;
}

after click upload this was the response : {“bytesSent”:165739, “responseCode”:302, “response”:"",“objectId”:""}

I need to check if the image is successfully upload. In my php i write a simple code just return “success” message in json format but i cant see it in the response. need help please? sorry if my english is bad.

Version :slight_smile:
cli packages:

@ionic/cli-plugin-proxy : 1.5.8
@ionic/cli-utils        : 1.19.3
ionic (Ionic CLI)       : 3.20.1

global packages:

cordova (Cordova CLI) : not installed

local packages:

@ionic/app-scripts : 3.2.1
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.9.1
npm               : 6.4.1
OS                : Windows 10

Hi, I did not read your code fully, but I can understand, your trying to upload images from camera. Below is the stackoverflow answer and gist link which may help you.
Stackoverflow: https://stackoverflow.com/questions/49270710/ionic-3-upload-multiple-images-with-extra-data/52830805#52830805
Github Gist: https://github.com/coolvasanth/upload-multiple-image-files-in-Ionic-3-4/blob/master/README.md

Sorry for my comment for not formatted very well thank you for your response. I will look at your suggestion.