Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.upstream.builtinDrivers.ftp.upstream
on upstream (adrfile, adrspec) {
<<Changes
<<2/1/02; 1:29:17 PM by JES
<<Added support for explicit passive/active mode setting.
<<11/12/01; 11:12:22 PM by JES
<<Get the upstream file-text through a call to radio.upstream.getUpstreamFileText. Fixed the setting of adrfile^.upstream.url to use the relative path set by radio.upstream.getUpstreamFileText.
<<6/21/01; 9:02:23 AM by DW
<<Created. adrfile points to a sub-table user.radio.settings.files, and adrspec points to an upstream spec derived from a #upstream.xml file whose type is ftp.
<<Our job is to upstream the file, set the url. Should be easy! ;->
<<8/14/01; 3:19:40 AM by JES
<<Override the messages from tcp.ftp.* with friendlier "Connecting to..." and "Writing to..." messages.
local (f = nameof (adrfile^));
<<local (filetext = string (file.readwholefile (f)))
local (relativePath = adrfile^.relativePath);
local (filetext = radio.upstream.getUpstreamText (f, @relativePath));
with adrspec^ {
local (password = string (user.radio.prefs.passwords.[passwordname]));
local (flpassive = true);
if defined (mode) {
if mode != "passive" {
flpassive = false}};
msg ("Connecting to " + server + "...");
local (adrconnection = tcp.ftp.openConnection (server, username, password, false));
local (filepath);
bundle { //set filepath
filepath = path;
if not (filepath endswith "/") {
filepath = filepath + "/"};
filepath = filepath + relativePath};
msg ("Writing '" + relativePath + "' to " + server + "...");
tcp.ftp.writefile (adrconnection, filetext, filepath, flpassive);
tcp.ftp.closeConnection (adrconnection);
msg ("")}; //clear the About window
bundle { //set the url
local (s = adrspec^.url);
if not (s endswith "/") {
s = s + "/"};
adrfile^.upstream.url = s + relativePath}}
<<bundle //test code
<<ftp (@user.radio.settings.files.["C:\\Program Files\\Radio UserLand\\www\\system\\upstream\\exodusImages\\lilwozpic.gif"], @system.temp.radio.upstreamSpecCache.["C:\\Program Files\\Radio UserLand\\www\\system\\upstream\\exodusImages\\#upstream.xml"])
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.