Dear Corona community,
what I’d like to do:
Download a file via network.download and store it in a subfolder of DocumentsDirectory for later access
what I’ve done so far:
Exactly this:
network.download(link, "POST", function(event) -- in case of an error if( event.isError ) then -- do something -- expected: download worked elseif(event.phase == "ended") then -- do something else end, "newsPics\\picture.jpg", system.DocumentsDirectory)
Does that work?
In windows simulator, it perfectly creates a new folder “newsPics” and stores the file “picture.jpg” in there. On iOS and Android, it also works, even though I cannot verify that it creates the folder or rather stores a file “newsPics\picture.jpg” in DocumentsDirectory. I can access the file via display.newImage and “newsPics\picture.jpg” as filename parameter no problem.
So why am I asking this question?
It would be great if someone could verify that this method is a valid one for creating a new folder or - if it already exists - just use it and store a file “picture.jpg” in there. Googling for this question says something else. According to the https://coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/ I might need Lua File System (LFS).
On all my test devices (iOS and Android) it worked without LFS. Could somebody explain me why?
Thanks in advance,
Chris