Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Trying to upload an image

$
0
0

@iothemhz wrote:

I am trying to upload an image and I am getting the following error

this is the upload image function

uploadImage() {
        
    this.storage.get('data').then((val) => {
          
      let postData = {
        token : val.key,
        account_id : val.ac_id,
        photo:  this.base64Image
      };
      
      this.studentsProvider.uploadFile(postData).subscribe(data => {                      
      }, (err) => {
        
        this.error = 'and the error is:'+JSON.stringify(err);
      });
    });       
  }


this is the uploadFile function in the provider 

  uploadFile(data : any ) {

    return this.http.post(this.apiUrlFileUpload,{
      'token': data.token,
      'account_id': data.account_id,      
      'photo' : data.photo
    },{headers: { 'Content-Type': 'application/json' }}).map(res => res); 
  }

the variable this.apiUrlFileUpload, is being filled manually and its not null. Can someone help?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



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