<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Inferno &#187; UploadToFTP</title>
	<atom:link href="http://www.viren.ca/blog/category/uploadtoftp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.viren.ca/blog</link>
	<description>It is a fallacy to state that something exists just because it can&#039;t be proven that it doesn&#039;t</description>
	<lastBuildDate>Tue, 07 Feb 2012 06:09:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Direct Upload to FTP</title>
		<link>http://www.viren.ca/blog/direct-upload-to-ftp/</link>
		<comments>http://www.viren.ca/blog/direct-upload-to-ftp/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 00:32:54 +0000</pubDate>
		<dc:creator>Viren</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[UploadToFTP]]></category>
		<category><![CDATA[direct image upload to FTP]]></category>
		<category><![CDATA[firefox add on]]></category>
		<category><![CDATA[mozilla firefox extension]]></category>
		<category><![CDATA[uploadToFTP mozilla firefox extension]]></category>

		<guid isPermaLink="false">http://www.viren.ca/blog/?p=638</guid>
		<description><![CDATA[Many&#8217;s the time I&#8217;ve surfed the vast wonders of the cybernetic ocean and wondered, &#8220;Wouldn&#8217;t it be nice to have this bit of coral back home, resting peacefully on the mantelpiece?&#8221;. Well, perendinate no longer! I present to you my first Firefox add-on, an add-on that lets you upload images you see on webpages directly [...]]]></description>
			<content:encoded><![CDATA[<p>Many&#8217;s the time I&#8217;ve surfed the vast wonders of the cybernetic ocean and wondered, &#8220;Wouldn&#8217;t it be nice to have this bit of coral back home, resting peacefully on the mantelpiece?&#8221;. Well, perendinate no longer! I present to you my first Firefox add-on, an add-on that lets you upload images you see on webpages directly to your website. Let me explain. If I see an image I like or wish to re-post on my blog, I have to do the following:</p>
<ol>
<li> Right click on image</li>
<li> Save to hard drive</li>
<li> Fire up an FTP client, Filezilla in this case</li>
<li> Connect to my FTP server</li>
<li> Load the directory with the downloaded image in the left pane, and the appropriate FTP directory in the right pane</li>
<li> Upload the file</li>
</ol>
<p>My add-on automates these steps. Since I don&#8217;t know how to use Javascript to upload a file to an FTP server, the script calls a PHP script which does the heavy lifting. I repeat that again: you must have a PHP-enabled webserver to run this add-on successfully. It doesn&#8217;t need to be a hosted one, I just run apache on my box and point the javascript to localhost. More detailed instructions are at the bottom. First, we look at how it works.</p>
<p>If you&#8217;re on some random site and think you want an image for your personal post or to share with others without being a leech on the original host, you right click on an image to see the context menu augmented by the &#8220;Upload To FTP&#8221; sub-menu.</p>
<p><img class="alignnone" src="http://www.viren.ca/images/contextmenu.png" alt="" width="816" height="630" /></p>
<p>Select the first option, &#8220;Images&#8221;. The second menu, &#8220;Fav 2&#8243; can be customized to whatever you want, if you&#8217;re so inclined, but it&#8217;s mostly there to show that other options can be added. If you right-click on a non-text element the context menu is still augmented. I followed the Mozilla instructions but wasn&#8217;t able to get the sub-menu to not show up on non-image environments. If anyone figures it out after looking at my code, please drop me a line.</p>
<p><img class="alignnone" src="http://www.viren.ca/images/contextmenuonbg.png" alt="" width="813" height="620" /></p>
<p>If you try to upload the non-image element, you get an error message stating that non-images cannot be uploaded at this time.</p>
<p><img class="alignnone" src="http://www.viren.ca/images/errormsg.png" alt="" width="812" height="682" /></p>
<p>Finally, we check the folder on my website where the images were sent to. If you try to add a file with the same name more than once, it increments the file name by the next digit. I don&#8217;t know if this will be useful, but I have often come across several image files with the same name and different content (think Google image search for: Canada) and I&#8217;d hate to see them overwritten and end up being the same file. We see:</p>
<p><img class="alignnone" src="http://www.viren.ca/images/uploadedimages.png" alt="" width="682" height="335" /></p>
<p>Here is the zip file containing both the XPI installer for the Firefox add-on, and the imgupload.php file. You can install the add-on by opening it with Firefox (File -&gt; Open File). I&#8217;ll submit it to the Firefox add-on repository soon.</p>
<p><a href="http://www.viren.ca/images/uploadToFTP.zip">UploadToFTP zip file</a>.</p>
<p>As for the PHP file, note that it does no error-checking whatsoever. Use it at your own risk. You&#8217;ll need to fill in parameters such as the FTP server name, login, password and upload folder. Once that&#8217;s done, host it in the root of your webserver&#8217;s public HTML directory and you&#8217;re done. If you host it in any other location, such as a subfolder or whatnot, then you need to update the &#8220;overlay.js&#8221; file in your Firefox profile&#8217;s <em>extensions/uploadtoftp@viren.kumar/content</em> folder.</p>
<p>Enjoy, and let me know if this is useful for you or if you&#8217;d like to see any upgrades or features.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viren.ca/blog/direct-upload-to-ftp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.305 seconds -->

