This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Code to get icon from website!
#1
Hi! I want to copy a file from the internet in png or jpg format to the LM memory card for use. I don't know how to copy that file, can someone help me?
For example, copy from here:
https://img.icons8.com/fluency/48/home.png
Then I want to copy that icon to a folder. Is it correct to use it like this?
-----------------------

dataweb = "Code to get icon from website"
if data then
a=io.writefile('/home/apps/store/data/lmcloud/icon.png', dataweb)
end
log(a)
----------------------
I am so happy to thank everyone !
Reply
#2
Try this:
Code:
url = 'https://img.icons8.com/fluency/48/home.png'
data = require('socket.http').request(url)

if data then
  io.writefile('/home/apps/store/data/lmcloud/icon.png', data)
end
Reply
#3
Oh, so good! I have done!
Reply


Forum Jump: