Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229600

Upload image in div element

$
0
0

now i am reduced my errors..but i have a run time error

Cannot read property 'file' of undefined

i tried ..

constructor(public file:File){}

function inside(){
    this.platform.ready().then( success=>{
     var options = {
    destinationType:this.camera.DestinationType.FILE_URI,
    sourceType:this.camera.PictureSourceType.PHOTOLIBRARY,
    allowEdit: true,
    encodingType:this.camera.EncodingType.JPEG,
     targetWidth: 1024,
      targetHeight: 768,
     saveToPhotoAlbum: false,
        correctOrientation: true
  };
this.camera.getPicture(options).then(function (sourcePath) {
     var sourceDirectory = sourcePath.substring(0, sourcePath.lastIndexOf('/') + 1);
             var sourceFileName = sourcePath.substring(sourcePath.lastIndexOf('/') + 1, sourcePath.length);
        sourceFileName = sourceFileName.split('?')[0];
             this.file.copyFile(sourceDirectory, sourceFileName,this.file.dataDirectory, sourceFileName).then(function (success) {
          this.uploadedImage = this.file.dataDirectory + sourceFileName;
               }, function (error) {
                 alert("error uncountered");
            });
   });
}

Viewing all articles
Browse latest Browse all 229600

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>