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

on upstream (adrfile, adrspec) {
		<<11/18/01; 4:24:11 PM by JES
			<<Fixed a bug where files would not be upstreamed: The name "password" is not defined. Check file extensions after calling radio.upstream.getUpstreamText, since the file's extension may change when it's rendered.
		<<11/13/01; 2:19:30 AM by JES
			<<Don't set flags here. They apply to all upstream folders, so they're set in radio.upstream.uploadChangedFiles instead. Get the upstream file-text through a call to radio.upstream.getUpstreamFileText.
		<<10/23/01; 1:47:10 AM by JES
			<<Changed <account> to <usernum>. Backward compatibility is maintained by radio.upstream.getUpstreamSpec.
		<<8/14/01; 3:18:47 AM by JES
			<<Override messages from xml.rpc and tcp.httpClient with more friendly "Upstreaming..." messages.
		<<7/24/01; 2:17:53 AM by JES
			<<Call radio.upstream.getServerCapabilities. Only upload the file if it's eligible, according to the data that the server returns.
				<<radio.upstream.getServerCapabilities will get the capabilities at most once per 24 hours.
				<<Account-specific storage allocation is ignored. Max file-size and extension are respected.
		<<6/22/01; 9:23:08 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! ;->
	local (f = nameof (adrfile^));
	local (relativePath = adrfile^.relativePath);
	local (filetext = radio.upstream.getUpstreamText (f, @relativePath));
	bundle { //call radio.upstream.getServerCapabilities, and see if the file qualifies for upstreaming
		local (adrCapabilities = radio.upstream.getServerCapabilities (adrspec));
		if adrCapabilities != false { //radio.upstream.getServerCapabilities returns false if the RPC call fails
			if file.size (f) > adrCapabilities^.maxFileSize { //the file is too big -- return false
				return (false)};
			local (fname = string.nthField (relativePath, '/', string.countFields (relativePath, '/')));
			local (extension = string.nthField (fname, '.', string.countFields (fname, '.')));
			if not (adrCapabilities^.legalFileExtensions contains extension) {
				return (false)}}};
	<<local (filetext = string (file.readwholefile (f)))
	local (data = adrspec^);
	data.fldebug = false;
	if not defined (data.soapAction) {
		data.soapAction = ""};
	if not defined (data.xmlRpcPath) {
		data.xmlRpcPath = ""};
	with adrspec^ {
		msg ("Upstreaming '" + relativePath + "' to " + data.server + "...");
		xmlStorageSystem.writeFile (usernum,[passwordName], relativePath, filetext, adrurl:@adrfile^.upstream.url, adrdata:@data, flShowMessages:false);
		msg ("")}}
	<<if string.lower (file.filefrompath (f)) != string.lower (
		<<[adrfile^.baseUpstreamFolder] = ()
<<bundle //test code
	<<upstream (["Backup:Radio UserLand:www:index.txt"],["Backup:Radio UserLand:www:#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.