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

system.verbs.builtins.radio.weblog.oldStuff.uploadImage

on uploadImage (adrfile) {
	<<Changes
		<<1/20/01; 10:08:33 AM by DW
			<<Created.
			<<Called from user.playlist.data.upstream.magicFolders.
			<<adrfile is the address of a table in user.playlist.data.upstream.files.
			<<Upload the file using the FTP prefs in the default blog.
			<<Set various fields of adrfile.
			<<Called from playlist.upstream.uploadChangedFiles.
		<<1/20/01; 1:40:09 PM by DW
			<<We weren't clearing the error so if it failed the first time it tried to upload it would keep uploading the file every ten seconds. Not good.
		<<2/23/01; 4:09:46 PM by JES
			<<Respect the blog pref, adrblog^.prefs.ftp.enabled.
		<<2/24/01; 1:59:18 AM by JES
			<<Fixed terminology mismatch; changed Blog Publish to Weblog Publish.
	local (startticks = clock.ticks (), path = "");
	try {
		local (adrblog = radio.weblog.init ());
		if adrblog^.prefs.ftp.enabled { //02/23/2001 JES: respect the FTP enabled pref
			local (f = adrfile^.f);
			path = "images/" + file.filefrompath (f);
			radio.weblog.uploadFile (adrblog, path, file.readWholeFile (f));
			adrfile^.ctUploads++;
			adrfile^.url = adrblog^.prefs.ftp.url + path;
			adrfile^.flerror = false;
			if user.radio.prefs.flLogWeblogPublish {
				local (htmltext = "<a href=\"" + adrfile^.url + "\">" + path + "</a> uploaded.");
				radio.log.add ("Weblog publish", htmltext, startticks)}}}
	else {
		if myUserLandData.prefs.flLogBlogPublish {
			local (htmltext = "Error uploading " + path + ": \"" + tryError + "\"");
			playlist.addToDailyLogDatabase ("Weblog publish", htmltext, startticks)};
		adrfile^.flerror = true}}
<<bundle //test code
	<<uploadImage (@user.playlist.data.upstream.files.["blog\\images\\checkmark.gif"])



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.