Page 1 of 1
ASCII Mode on Server
Posted: Tue Dec 24, 2013 11:03 pm
by AccentureDan
Is there a way to force the server to accept ASCII data transfer? Trying to do so with an IBM mainframe client (FTPS, mainframe is connecting to our Wing FTP Server) but I am being told we are listening to binary only.
Thanks!
Dan
Re: ASCII Mode on Server
Posted: Fri Dec 27, 2013 2:00 am
by FTP
Yes, there is binary mode only, because Wing FTP Server won't change the content of the transferred file.
Anyway, you can use Event Manager to handle such requirement, just input the below Lua script into the event "OnFileUploaded":
Code: Select all
local fname = string.gsub("%PathName", "\\","/")
local ext = string.sub(fname,1-string.find(string.reverse(fname),"%."))
local types = "|am|asp|bat|c|cfm|cgi|conf|cpp|css|dhtml|diz|h|hpp|htm|html|in|inc|js|jsp|m4|mak|md5|nfo|nsi|pas|patch|php|phtml|pl|po|py|qmail|sh|shtml|sql|svg|tcl|tpl|txt|vbs|xhtml|xml|xrc|ini|log|java|lua|log|"
if string.find(types, "|"..ext.."|") then
local fp = assert(io.open(fname, "rb"))
local content = fp:read("*all")
fp:close()
content = content.gsub(content, "\r\n", "\n")
content = content.gsub(content, "\r", "\n")
local fp = assert(io.open(fname, "wb"))
fp:write(content)
fp:close()
end