title: how can i able to send pdf or any doc file on database using post form-data in ionic 3?
body: <p>How can i post form data with file on database in ionic 3?</p>
  
  <p>I have already tried following  solution:</p>
  
  <p>my service.ts file:</p>
  
  <pre><code>addFilesApi(data): Observable&lt;any&gt; {
   console.log("addFilesApi service data", data);
  
   let headers = new Headers({ "enctype": "multipart/form-data" });
  
   var form_data = new FormData();
   for (var key in data) {
    console.log("addFilesApi key", key);
    form_data.append(key, data[key]);
     console.log("addFilesApi form_data", form_data);
   }
  
  return this.http.post(apiUrl + 'FilesModule/addFile', form_data, { headers: headers })
    .map((response) =&gt; {
      console.log("addFilesApi response", response.json());
      return response.json();
    })
    // .catch(this.handleError);
  }
  </code></pre>
  
  <p>my home.ts file: </p>
  
  <pre><code>addFilesforRNAppz(event) {
  
   let eventObj: MSInputMethodContext = &lt;MSInputMethodContext&gt;event;
   let target: HTMLInputElement = &lt;HTMLInputElement&gt;eventObj.target;
   let files = target.files;
  
   let file = files[0];
   let fileObj = {
        User_Id: this.userId,
        sessionId: this.sessionId,
        File_Name: file,
        File_Description: "new file created",
        Categories_Id: 1
      }
  
   this.serviceProvider.addFilesApi(fileObj).subscribe((result) =&gt; {
        // this.loader.hide();
        console.log("result addFilesApi" +JSON.stringify(result));
        // this.notes = result["data"];
        if(result['success'] == 4) {
          this.errorMessage = '';
          let alert = this.alertCtrl.create({
            subTitle: result["message"],
            buttons: [
              {
                text: 'OK',
                handler: () =&gt; {
                  console.log('ok clicked');
                  this.navCtrl.push("SigninPage");
                }
              }
            ]
          });
          alert.present();
        } else if(result['success'] == 1) {
          this.errorMessage = '';
          this.getFilesFromDatabase();
        } else if(result['success'] == 2) {
          this.errorMessage = result['message'];
        } else {
  
        }
  
      }, (err) =&gt; {
        // this.loader.hide();
        console.log("err addFilesApi" +JSON.stringify(err));
        // Error log
      });
  
  }
  </code></pre>
  
  <p>my home.html file:</p>
  
  <p></p>
  
  <p>I can send image to server, but couldn't post file in database. I have to save any type of file in mysql database with form data parameter.</p>
  
  <p>How it is possible, If you have any solution, please share here as soon as possible.</p>