You're welcome
And here you have some library for easy download a file to ftp:
Example:
And here you have some library for easy download a file to ftp:
Code:
-- download a file to ftp filename e.g. snapshot.jpg
function download2ftp(url, filename)
path = '/home/ftp/' .. filename
os.execute('wget -O ' .. path .. ' ' .. url .. '')
file = io.readfile(path)
-- Download start
repeat
os.sleep(0.2)
file = io.readfile(path)
until file
-- Download finish
repeat
before = #file
os.sleep(0.2)
file = io.readfile(path)
current = #file
until current == before
return file, path
end
Example:
Code:
url = 'http://camera_mpeg_address/'
filename = 'snapshot.jpg'
image, path = download2ftp(url, filename)
-- image is for using in email
-- path is for using e.g. when you want remove image after email send
-- remove downloaded file
os.remove(path)