Selecting Image from Gallery or Camera always not showing the Image Name and not able to send the selected Image to server


I am developing an app for device using Ionic, Web API,

Here I am sending images from Gallery or taken from Camera to server for that I am using the $cordovaCamera.getPicture. but when I open the Image Gallery and debug the application I am not getting the actula file name while selecting the image.

I am getting this URL while selecting image "blob:http://localhost:4400/de7a5b7b-3d1b-4972-834c-6207af82886d"
I have tried all the way to get the file name but I am not able to get the image name.

my code as below

        self.saveMedia = function (type) {
            return $q(function (resolve, reject) {
                var options = self.optionsForType(type);

                $cordovaCamera.getPicture(options).then(function (imageBase64) {

  self.optionsForType = function (type) {
                var source;
                switch (type) {
                    case 0:
                        source = Camera.PictureSourceType.CAMERA;
                    case 1:
                        source = Camera.PictureSourceType.PHOTOLIBRARY;
                return {
                    quality: 90,
                    destinationType: Camera.DestinationType.DATA_URL,
                    sourceType: source,
                    allowEdit: false,
                    encodingType: Camera.EncodingType.JPEG,
                    popoverOptions: CameraPopoverOptions,
                    saveToPhotoAlbum: false,
                    correctOrientation: true

       self.addImages = function (files) {
                self.FileName = "data:image/jpeg;base64," + files;
                $scope.selectedFile = self.FileName;
                var formdata = new FormData();
                var uploadOptions = new FileUploadOptions();
                uploadOptions.fileKey = "file";
                uploadOptions.fileName = self.FileName.substr(self.FileName.lastIndexOf('/') + 1);
                uploadOptions.mimeType = "image/jpeg";
                uploadOptions.chunkedMode = false;
                var params = {};
                params.accessToken = localStorage.getItem('accessToken');
                uploadOptions.params = params;
                formdata.append("file", uploadOptions);
                var uplodedFile = getFileViewModel(uploadOptions.fileName);
                var curVM = getMessageViewModel({
                    message: $scope.message,
                    messageType: 2,
                    FileSystemModels: images
                formdata.append("messagedetailobject", JSON.stringify(curVM));
                formdata.append("messageexpirationtime", GENERAL_CONFIG.APP_messageExpiryTimeLimit);
                var fileUploaded = appService.uploadFiles(formdata); // **here I am sending data to service but formData is blank**
                fileUploaded.then(function (obj) {
                }, function (error) {
                      console.log('Error in getting room records' + error.message);
                    alert('Error in getting room records' + error.message);

Here I am able to get **formdata** it always blank while sending it to server. Also I am not able to get the image name while selecting the Image from gallery or from Camera.


anybody please reply on this…
Thanks in advance :slight_smile:


Hi Pitis,
Did you find any way to get the selected image information, I am also looking for the same thing.
Please share information if you find any solution.