LUA scripting for FlashAir Card
- or -
Post a project like this£10(approx. $13)
- Posted:
- Proposals: 0
- Remote
- #1330141
- Expired
Description
Experience Level: Intermediate
General information for the business: Flash air card script
Kind of development: Customization of existing program
Description of requirements/functionality: have a flash air card it currently uploads to a FTP server but each time the upload is triggered it reuploads the entire folder i wish to dump the filename to text file and have it validate against this before it uploads a file id also like it to check if a file uploaded correctly and if not reupload it (this may be too intensive)
the idea is i take a snap on the camera (18mb in some cases) and it will push upload it to the ftp server via my mobile hotspot on the phone it valadates the files are there and logs that this file has been uploaded so the next photo i take it isnt starting over from scratch
Extra notes: local logfile = "/ftplog.txt" -- Where to log output on the FA
local folder = "/DCIM/100__TSB" -- What folder to upload files from
local server = "ftp.drivehq.com" -- The FTP server's IP
local serverDir = "/wwwhome/" -- The path on the FTP server to use.
local user = "flashair" -- FTP username
local passwd = "*****" -- FTP passwd
local outuploadlog = "/putlog.txt" -- log of filenames uploaded
-- Assemble our FTP command string
-- example: "ftp://user:pass@192.168.1.1/"
local ftpstring = "ftp://"..user..":"..passwd.."@"..server..serverDir
-- Open the log file
local outfile = io.open(logfile, "w")
-- Write a header
outfile:write("File list: \n")
-- Put ftp string
outfile:write(ftpstring)
-- For each file in folder...
for file in lfs.dir(folder) do
-- Get that file's attributes
attr = lfs.attributes(folder .. "/" .. file)
print( "Found "..attr.mode..": " .. file )
-- Don't worry about directories (yet)
if attr.mode == "file" then
--Attempt to upload the file!
--ex ftp("put", "ftp://user:pass@192.168.1.1/test.jpg", "Upload/test.jpg")
response = fa.ftp("put", ftpstring..file, folder .. "/" .. file)
--Check to see if it worked, and log the result!
if response ~= nil then
print("Success!")
outfile:write("" .. file .. ".Success!\n")
outfile:close(logfile)
local outfile = io.open(outuploadlog, "w")
outfile:write("" .. file .. "")
outfile:close(outuploadlog)
else
local outfile = io.open(logfile, "w")
print("Fail :(")
outfile:close(logfile)
local outfile = io.open(outuploadlog, "w")
outfile:write("" .. file .. "")
outfile:close(outuploadlog)
local outfile = io.open(logfile, "w")
outfile:write("" .. file .. ".Fail \n")
end
end
end
--Close our log file
outfile:close()
Kind of development: Customization of existing program
Description of requirements/functionality: have a flash air card it currently uploads to a FTP server but each time the upload is triggered it reuploads the entire folder i wish to dump the filename to text file and have it validate against this before it uploads a file id also like it to check if a file uploaded correctly and if not reupload it (this may be too intensive)
the idea is i take a snap on the camera (18mb in some cases) and it will push upload it to the ftp server via my mobile hotspot on the phone it valadates the files are there and logs that this file has been uploaded so the next photo i take it isnt starting over from scratch
Extra notes: local logfile = "/ftplog.txt" -- Where to log output on the FA
local folder = "/DCIM/100__TSB" -- What folder to upload files from
local server = "ftp.drivehq.com" -- The FTP server's IP
local serverDir = "/wwwhome/" -- The path on the FTP server to use.
local user = "flashair" -- FTP username
local passwd = "*****" -- FTP passwd
local outuploadlog = "/putlog.txt" -- log of filenames uploaded
-- Assemble our FTP command string
-- example: "ftp://user:pass@192.168.1.1/"
local ftpstring = "ftp://"..user..":"..passwd.."@"..server..serverDir
-- Open the log file
local outfile = io.open(logfile, "w")
-- Write a header
outfile:write("File list: \n")
-- Put ftp string
outfile:write(ftpstring)
-- For each file in folder...
for file in lfs.dir(folder) do
-- Get that file's attributes
attr = lfs.attributes(folder .. "/" .. file)
print( "Found "..attr.mode..": " .. file )
-- Don't worry about directories (yet)
if attr.mode == "file" then
--Attempt to upload the file!
--ex ftp("put", "ftp://user:pass@192.168.1.1/test.jpg", "Upload/test.jpg")
response = fa.ftp("put", ftpstring..file, folder .. "/" .. file)
--Check to see if it worked, and log the result!
if response ~= nil then
print("Success!")
outfile:write("" .. file .. ".Success!\n")
outfile:close(logfile)
local outfile = io.open(outuploadlog, "w")
outfile:write("" .. file .. "")
outfile:close(outuploadlog)
else
local outfile = io.open(logfile, "w")
print("Fail :(")
outfile:close(logfile)
local outfile = io.open(outuploadlog, "w")
outfile:write("" .. file .. "")
outfile:close(outuploadlog)
local outfile = io.open(logfile, "w")
outfile:write("" .. file .. ".Fail \n")
end
end
end
--Close our log file
outfile:close()
ErskineTech LTD
100% (20)Projects Completed
35
Freelancers worked with
32
Projects awarded
40%
Last project
23 Aug 2024
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies