rickdog
7/22/2013 - 11:55 PM

filepicker.io.js

filepicker.io.js

(
  function()
	 {
		 var start = function() { doDialog(); };
		 if (typeof filepicker=='undefined')
		 {
			 var s = document.createElement('script');
			 s.src = 'http://api.filepicker.io/v1/filepicker.js';
			 if (s.addEventListener)
			 {
				 s.addEventListener("load", start, false);
			 }
			 else
			 {
				s.onreadystatechange=function()
				{
					if (this.readyState=="complete")
					{
						start();
						s = null;
					}
				}
			 }
			 s.type = "text/javascript";
			 document.getElementsByTagName('head')[0].appendChild(s);
		 }
		 else
		 {
			 start();
		 }
	 }
)();

function doDialog()
{
		filepicker.setKey('A0b1GBdwgSyv6Pop9ZFNQz');

		// load dialog
		filepicker.pick
		(
			function(InkBlob)
			{
	  			console.log(InkBlob.url);
			}
		);
}


/*
// save URL to filepicker
filepicker.storeUrl("http://cdn.appstorm.net/web.appstorm.net/web/files/2013/06/aologo.png", function(InkBlob){
  alert(InkBlob.url) 
});
*/

/*
// save to any.
filepicker.exportFile(
  'https://drpyjw32lhcoa.cloudfront.net/c882d28/img/success.png',
  {mimetype:'image/png'},
  function(InkBlob){
    console.log(InkBlob.url);
});
*/