ASCII Mode on Server

Please post here if you have problems in using Wing FTP Server.
Post Reply
AccentureDan
Posts: 1
Joined: Tue Dec 24, 2013 11:00 pm

ASCII Mode on Server

Post 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
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: ASCII Mode on Server

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