How to save image or file from other server in ionic app?


#1

Hi friends i want to save file or image from another server in ionic app? Actually my requerment is when internate is not working then app should work offline also.User can downlod data but a button and all data saved in app storage.?Any idea


#2

from what I understand you want to download files so the user can browse them offline ,
check this question :


and check this plugin :
http://ngcordova.com/docs/plugins/fileTransfer/


#3

When i use this code this error come in console log :

ReferenceError: cordova is not defined


#4

are you trying this code on the browser or real device ?


#5

i am using in browser


#6

try using real device , and it should work
working with native features like http … etc requires real device or simulator/emulator or some special settings


#7

i want this should save in app storage like in www folder image folder so i can access this is my code


#8

try it on a real device and see if it works if so search for the folder and you can access it later


#9

ok sir thanks i will check it


#10

Now file donwload successfully.But problem is its downlod in documentsDirectory and how i can access this file in app from documentsDirectory ??