title: IONIC : cannot send request with FormData using Awesome Cordova plugins HTTP (Capacitor)
body: <p>guys I just tried to send a photo to the API in my ionic V6 (Angular, Capacitor) project but the problem is that the request didn't sent to the API and there is no problem appearing in the console or in the android studio debugging terminal.
  And when I tried to send the data in JSON Format the app worked as expected.
  Can someone help me please cause I need to fix this issue?</p>
  <p>this is my request service:</p>
  <pre><code>sendRequest(url,data,method){
  if (isPlatform('capacitor')) {
    return from( new Promise((resolve, reject) =&gt; {
      // disable SSL cert checking, only meant for testing purposes, do NOT use in production!
      this.https.setServerTrustMode('nocheck');
      this.https.setHeader('*', 'Authorization', &quot; &quot; + this.token);
      // this.https.setHeader('')
      //Important to set the data serializer or the request gets rejected
      this.https.setDataSerializer('multipart');
      this.https.sendRequest(url,{method:method,data:data,headers:{&quot;Authorization&quot;:this.token} }).then(res =&gt; {
          resolve(JSON.parse(res.data));
      })
          .catch(err =&gt; {
              reject(err);
          });
  }))
  
  }else{
    return  this.http.post(url, data,{headers:{&quot;Authorization&quot;:this.token}})
  }
  </code></pre>
  <p>}</p>
  <p>this is a middleware service that makes calls to the request services with different parameters :</p>
  <pre><code>add(data: any, pageSize = 0, page = 0) {
  this.requestServices.sendRequest(apiUrl + '/eleveur/create', data,'post').subscribe(
   async (data) =&gt; {
      console.log(data);
      
      const dataE = JSON.parse(JSON.stringify(data))
      if (dataE.ok) {
        this.getAll(pageSize, page)
        const toast = await this.toastController.create({
          message: &quot;l'ajout est faite&quot;,
          duration: 5000
        });
        toast.present();
        this.router.navigate(['/listEleveur'])
      } else {
        const toast = await this.toastController.create({
          message: dataE.error[0].message,
          duration: 5000
        });
        toast.present();
      }
  
    },
    async (error) =&gt; {
      console.log(error);
      const toast = await this.toastController.create({
        message: error.error.message,
        duration: 5000,
        color:'danger'
      });
      toast.present();
      
    }
  )
  </code></pre>
  <p>}</p>
  <p>and this is the code that makes calls to the middleware service and get the data from the forms:</p>
  <pre><code>async enregistre() {
  if (this.form.invalid) {
    return
  }
  if (!this.form.invalid) {
    const file: LocalFile = this.images[this.images.length]
    const response = await fetch(file?.data)
    const blob = await response.blob()
    const fd = new FormData()
    console.log(&quot;Blob File :&quot;, blob);
    console.log(&quot;FILE NAME : &quot;, file?.name);
  
  
    fd.append('photo', blob, file?.name)
    fd.append('code', this.form.get('code')?.value)
    fd.append('adresse', this.form.get('adresse')?.value)
    fd.append('numeroCIN', this.form.get('numeroCIN')?.value)
    fd.append('nom', this.form.get('nom')?.value)
    fd.append('prenom', this.form.get('prenom')?.value)
    fd.append('tel', this.form.get('tel')?.value)
    fd.append('type', this.form.get('type')?.value)
    fd.append('delegationId', this.form.get('delegationId')?.value)
    fd.append('position', JSON.stringify(this.position))
    fd.append('photo', this.userImage)
    
    if (this.form.get('status')?.value != null) {
      fd.append('status', this.form.get('status')?.value)
    }
    if (this.form.get('login')?.value != null) {
      fd.append('login', this.form.get('login')?.value)
    }
    if (this.form.get('email')?.value != null) {
      fd.append('email', this.form.get('email')?.value)
    }
    if (this.form.get('motDePasse')?.value != null) {
      fd.append('motDePasse', this.form.get('motDePasse')?.value)
    }
  
  
    this.eleveurService.add(fd);
  
  } 
  </code></pre>
  <p>}</p>