Monday, November 08, 2010 at 12:05 AM.

on upstream (adrfile, adrspec) {
		<<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, 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 ([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 (["C:\\Program Files\\Radio UserLand\\www\\system\\upstream\\exodusImages\\lilwozpic.gif"],["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.