0

I am developing an application using ionic framework and there is a requirement for converting base64 string back to a file and store in the app itself without interacting with server. However, I can't seem to find any way of converting base64 string back to file. Appreciate if someone could help.

stackdisplay
  • 1,949
  • 6
  • 29
  • 46
  • This might help you - http://stackoverflow.com/questions/4998908/convert-data-uri-to-file-then-append-to-formdata – Nehil Mistry Apr 19 '16 at 14:01
  • if you like to store the taken image with your app itself means please follow this tutorial https://devdactic.com/how-to-capture-and-store-images-with-ionic/ – Mohan Gopi Apr 19 '16 at 14:02
  • @MohanGopi what i mean is that i retrieve an base 64 data uri string from a server. Then, i need to convert it back to a file on the app itself and save into a certain location in the phone. – stackdisplay Apr 19 '16 at 14:04
  • @stackdisplay cool just go through the tutorial that i have posted in above comment so that you can have the idea of storing the image in app. if you are getting the image as base64 from serve then combine **"data:image/jpeg;base64," + "place your base64 string in here";** it will convert to image file so that based up on that tutorial you can make it store in your app – Mohan Gopi Apr 19 '16 at 14:08
  • do you mean replace the fileURI in `window.resolveLocalFileSystemURL(fileURI, copyFile, fail);` with the base 64 string? I thought the fileURI suppose to be a file path – stackdisplay Apr 19 '16 at 14:20

0 Answers0