title: AWS S3 getting Not a valid bitmap file
body: <p>I have been struggling with this for a while and I am going to provide you with as much information as possible (some maybe irrelevant) because I am completely stuck.  I am using Ionic and I would like to be able to take a picture with my phone and upload it to an AWS S3 bucket.  I used <a href="https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/index.html" rel="noreferrer">Cordova camera</a> to accomplish this.  </p>
  
  <p>As far as I know; these pictures come out in a large base64 string and I have to convert it to a Blob, convert it to a File object then upload that file object into AWS.  However, when I do this it always uploads it as something other than an image.  Whenever I open it I get an error saying:</p>
  
  <pre><code>"Not a valid bitmap file.  its format is not currently supported."
  </code></pre>
  
  <p><a href="https://s3.amazonaws.com/mng-moment/moment/PA/40.008446_-75.26046_1502414224619.jpg" rel="noreferrer">https://s3.amazonaws.com/mng-moment/moment/PA/40.008446_-75.26046_1502414224619.jpg</a></p>
  
  <p>Here is an example of a WORKING one (This used to work it somehow broke):</p>
  
  <p><a href="https://s3.amazonaws.com/mng-moment/bestMoments/40.008446_-75.26046_1499659199473.jpg" rel="noreferrer">https://s3.amazonaws.com/mng-moment/bestMoments/40.008446_-75.26046_1499659199473.jpg</a></p>
  
  <p>I tried to open each one in a text editor to see what is going on.  For the first one (The broken one) I get this:</p>
  
  <p><a href="https://i.stack.imgur.com/zI5jz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zI5jz.png" alt="enter image description here"></a></p>
  
  <p>When I try to open the working one in a text editor I get this:</p>
  
  <p><a href="https://i.stack.imgur.com/wFJrt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wFJrt.png" alt="enter image description here"></a></p>
  
  <p>Now it seems like a conversion problem but I think I am converting it correctly. 
   Here is the code I am using to upload (You can see the console.logs later on the post):</p>
  
  <p><a href="https://i.stack.imgur.com/Wu0nJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Wu0nJ.png" alt="enter image description here"></a></p>
  
  <p>core.js</p>
  
  <p><a href="https://i.stack.imgur.com/15A3O.png" rel="noreferrer"><img src="https://i.stack.imgur.com/15A3O.png" alt="enter image description here"></a></p>
  
  <p>awsServices.js</p>
  
  <p><a href="https://i.stack.imgur.com/zXkRV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zXkRV.png" alt="enter image description here"></a></p>
  
  <p>If you look at the comments in the code I labeled some of the console logs.  I will display them here for more information:</p>
  
  <p>A - (uploadToAWS):</p>
  
  <p><a href="https://i.stack.imgur.com/IIrya.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IIrya.png" alt="A (uploadToAWS)"></a></p>
  
  <p>B - (awsServices.upload):</p>
  
  <p><a href="https://i.stack.imgur.com/KPND9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KPND9.png" alt="B (awsServices.upload)"></a></p>
  
  <p>This is how I convert the dataURI to a Blob (Called in uplpoadToAWS - The first screenshot):</p>
  
  <p><a href="https://i.stack.imgur.com/q4AVf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/q4AVf.png" alt="enter image description here"></a></p>
  
  <p>This is what gets passed into the 'dataURI' parameter in the code right above:
  <a href="https://i.stack.imgur.com/M7gK0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/M7gK0.png" alt="enter image description here"></a></p>
  
  <p>If there is any more information please let me know.  I've been scratching my head at this for a while.  Any help is appreciated.  Thanks!</p>