title: Ionic 2/3 filetransfer upload error
body: <p>I am always getting one of these errors even if the image is uploaded.</p>
  
  <p>Note :
   the code works sometimes when I leave the app running without any requests for a while otherwise I get the errors below .</p>
  
  <pre><code>// Destination URL
  let url = "https://***s.me/petupload.php";
  
  // File for Upload
  let targetPath = imgpath;
  // File name only
  let filename = imgname;
  
  let options: FileUploadOptions = {
  fileKey: "file",
  fileName: filename,
  chunkedMode: false,
  mimeType: "multipart/form-data",
  headers:{ Connection: "close"},
  params : {'fileName': filename,func: "upload"}};
  
  
  let  fileTransfer: FileTransferObject =
  this.filetransfer.create();
  
  
  
  // Use the FileTransfer to upload the image
  fileTransfer.upload(targetPath, url, options,true).then(data =&gt; {
  console.log(JSON.stringify(data.response));
  console.log("image sent");}, err =&gt; {
  console.log(JSON.stringify(err));});
  </code></pre>
  
  <p>Errors:</p>
  
  <blockquote>
    <p>{“code”:3,“source”:“file:///data/user/0/io.ionic.starter/files       /amarimg.jpg”,“target”:“https://***s.me/petupload.php",“http_status”:null,“body”:null,“exception”:"state:
    2”}</p>
    
    <p>{“code”:3,“source”:“file:///data/user/0/io.ionic.starter/files/amarimg.jpg”,“target”:“https://***s.me/petupload.php",“http_status”:null,“body”:null,“exception”:"expected
    1596 bytes but received 16384”}</p>
  </blockquote>
  
  <p>In my php i have the following headers</p>
  
  <pre><code>header("Access-Control-Allow-Origin: *");
  header("Content-type:multipart/form-data");
  
  header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-  Disposition, Content-Description');
  header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
  
  
  
  $target_path = "/var/www/html/";//"uploads/";
  
  $target_path = $target_path . basename( $_FILES['file']['name']);
  
  
  if(isset($_POST['func'])){ 
  if (move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
  echo "Upload and move success";
  } else {
  echo $target_path;
  echo "There was an error uploading the file, please try again!";}
  ;}else{echo"no func";}
  </code></pre>
  
  <p>any thoughts ??</p>
  
  <p>this issue has been solved by ewizard</p>
  
  <p>should this mimeType: "multipart/form-data" be this mimeType: "image/jpeg"? you can actually remove the mimeType...it defaults to image/jpeg also maybe remove chunkedMode</p>
  
  <p>however i still need to use multipart/form-data if possible thats why im leaving this issue open.</p>