Latest update: March 2015
With Lua, your FlashAir can download any files accessible with HTTP (as well as with some other protocols, such at FTP).
For HTTP, it’s as simple as making an HTTPGetFile request. For example, if your FlashAir was configured in Station Mode and you wanted to download an image (in this case, the FlashAir logo) all you would need to do is the following:
result = fa.HTTPGetFile("https://flashair-developers.com/images/assets/flashairLogo_official_small.png", "logo.png") if result ~= nil then print("Success! File downloaded.\n") --process the file else print("Failure! File failed to download...\n") end
You can also access password protected files by supplying a username and password with your HTTP request, for example:
result = fa.HTTPGetFile("http://somewhere/secretfile.txt", "secretfile.txt", "aUser", "passw0rd") if result ~= nil then ... (snip) ...
Once the download is complete (it can take some time – be patient!) your script can do almost anything with the file.
All sample code on this page is licensed under BSD 2-Clause License