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

system.verbs.builtins.radio.upstream.builtinDrivers.ftp.upstreamMultipleFiles

on upstreamMultipleFiles (fileslist, adrspec, adrresponse) {
	<<Changes
		<<2/1/02; 1:29:17 PM by JES
			<<Added support for explicit passive/active mode setting.
		<<12/10/01; 11:50:09 AM by DW
			<<Display progress in the about window. We can give more detailed feedback than the xmlStorageSystem driver can, so be it -- I want to see as much of what's happening as possible.
		<<12/9/01; 11:51:02 AM by DW
			<<Created.
	with adrspec^ {
		bundle { //set up response table
			new (tabletype, adrresponse);
			adrresponse^.urllist = {};
			adrresponse^.flerror = false;
			adrresponse^.message = ""};
		local (password = string (user.radio.prefs.passwords.[passwordname]));
		local (flpassive = true);
		if defined (mode) {
			if mode != "passive" {
				flpassive = false}};
		msg ("FTP upstream driver: Opening connection.");
		local (adrconnection = tcp.ftp.openConnection (server, username, password, false));
		local (adrfile);
		for adrfile in fileslist {
			local (f = nameof (adrfile^));
			local (relativePath = adrfile^.relativePath);
			local (filetext = radio.upstream.getUpstreamText (f, @relativePath));
			local (filepath);
			bundle { //set filepath
				filepath = path;
				if not (filepath endswith "/") {
					filepath = filepath + "/"};
				filepath = filepath + relativePath};
			try {
				msg ("FTP upstream driver: Uploading \"" + relativePath + "\".");
				tcp.ftp.writefile (adrconnection, filetext, filepath, flpassive);
				bundle { //set the url
					local (s = adrspec^.url);
					if not (s endswith "/") {
						s = s + "/"};
					adrfile^.upstream.url = s + relativePath;
					adrresponse^.urllist = adrresponse^.urllist + {adrfile^.upstream.url}}}
			else {
				adrresponse^.urllist = adrresponse^.urllist + {""};
				adrresponse^.message = "One or more files failed to upstream because " + tryError;
				adrresponse^.flerror = true}};
		msg ("FTP upstream driver: Closing connection.");
		tcp.ftp.closeConnection (adrconnection);
		msg ("")}} //clear the about window
<<bundle //test code
	<<upstreamMultipleFiles (scratchpad.streams [1].files, @system.temp.radio.upstreamSpecCache.["C:\\Program Files\\Radio UserLand\\www\\scriptingcom\\#upstream.xml"], @scratchpad.response)



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.