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.

E-mail with attachment
#10
You're welcomeSmile

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)
Reply


Messages In This Thread
E-mail with attachment - by admin - 21.09.2016, 06:34
RE: E-mail with attachment - by buuuudzik - 11.03.2017, 07:29
RE: E-mail with attachment - by buuuudzik - 15.03.2017, 09:35
RE: E-mail with attachment - by admin - 15.03.2017, 10:46
RE: E-mail with attachment - by buuuudzik - 15.03.2017, 11:00
RE: E-mail with attachment - by admin - 15.03.2017, 11:06
RE: E-mail with attachment - by buuuudzik - 15.03.2017, 11:12
RE: E-mail with attachment - by Keitz - 22.10.2017, 18:11
RE: E-mail with attachment - by buuuudzik - 17.03.2017, 16:59
RE: E-mail with attachment - by buuuudzik - 22.10.2017, 18:24
RE: E-mail with attachment - by iJAF - 06.04.2022, 17:31
RE: E-mail with attachment - by admin - 11.04.2022, 09:44

Forum Jump: