<?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>Bytearray - Programming, Computers and Technology &#187; file uploader</title>
	<atom:link href="http://bytearray.brixtonjunkies.com/tag/file-uploader/feed/" rel="self" type="application/rss+xml" />
	<link>http://bytearray.brixtonjunkies.com</link>
	<description></description>
	<lastBuildDate>Tue, 03 Nov 2009 11:52:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Flex: Multiple File Uploader</title>
		<link>http://bytearray.brixtonjunkies.com/2009/10/01/flex-multiple-file-uploader/</link>
		<comments>http://bytearray.brixtonjunkies.com/2009/10/01/flex-multiple-file-uploader/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 14:32:27 +0000</pubDate>
		<dc:creator>alchemist</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[file uploader]]></category>
		<category><![CDATA[flex uploader]]></category>
		<category><![CDATA[multi uploader]]></category>
		<category><![CDATA[uploader]]></category>

		<guid isPermaLink="false">http://bytearray.brixtonjunkies.com/?p=529</guid>
		<description><![CDATA[Uploading is such a common task and can often be a little painful so I decided to write a small library in Flex which simplifies the task. I have released it under GPL license so feel free to use and modify it according to the conditions The Flex client side uploader supports multiple file upload [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bytearray.brixtonjunkies.com/wp-content/uploads/2009/10/uploader.jpg"><img class="size-full wp-image-528  alignleft" title="Flex Multi Uploader" src="http://bytearray.brixtonjunkies.com/wp-content/uploads/2009/10/uploader.jpg" alt="Flex Multi Uploader" width="378" height="178" /></a>Uploading is such a common task and can often be a little painful so I decided to write a small library in Flex which simplifies the task. I have released it under GPL license so feel free to use and modify it according to the conditions <img src='http://bytearray.brixtonjunkies.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The Flex client side uploader supports multiple file upload with queuing and multiple threads, meaning more than one upload can be active at a time. It is also written in component style so creating an instance of the uploader is very simple and can be achieved in only a few lines of code <em>(see the example below).</em> It also supports posted additional data with the file upload, handy if you need to pass instructions to the back-end upload script.</p>
<p>The back-end script is not included in the library but could easily be implemented in any language. I have however supplied a <strong>PHP</strong> example below of how to implement the back-end script to support the Flex uploader <em>(see the example below).</em> </p>
<p>One final note, this code is not polished, it&#8217;s definitely Alpha&#8230;but still very usable. If you have any issues or questions please let me know, cheers.</p>
<p><em><strong>Simple example implementation of uploader library</strong></em></p>
<pre class="brush: as3; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
				xmlns:cc=&quot;FileUploader.Renderers.*&quot;
				layout=&quot;absolute&quot;
			    creationComplete=&quot;{init()}&quot;
			    width=&quot;1018&quot;
			    height=&quot;455&quot;
				&gt;
	&lt;mx:Script&gt;
		&lt;![CDATA[

			private function init():void{
				fileUploader.addPostData('mydata','1234567890');
			}

		]]&gt;
	&lt;/mx:Script&gt;

	&lt;cc:FileUploadComp id=&quot;fileUploader&quot;
					   x=&quot;0&quot;
					   top=&quot;8&quot;
					   left=&quot;8&quot;
					   width=&quot;1000&quot;
					   maxThreadsEnabled=&quot;true&quot;
					   uploadUrl=&quot;http://a.b.c.d/MyUploaderScript.php&quot;
					   /&gt;
&lt;/mx:Application&gt;
</pre>
<p><em><br />
<strong>PHP backend example implementation of uploader code</strong></em></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
	$tmpFileName = isset($_FILES['Filedata']['tmp_name']) ? $_FILES['Filedata']['tmp_name'] : '';
	$orgFileName = isset($_FILES['Filedata']['name']) ? $_FILES['Filedata']['name'] : '';
	$mydata = isset($_REQUEST['mydata']) ? $_REQUEST['mydata'] : '';

	error_log('tmpfile: ' . $tmpFileName);
	error_log('filename: ' . $orgFileName);
	error_log('mydata: ' . $mydata);	

	if (true){
		print 'ok';
	}
	else{
		header('Status: 500 ' . $resultAry[1]);
		header('HTTP/1.1 500 ' . $resultAry[1]);

		$outputStr = '&lt;!DOCTYPE HTML PUBLIC \&quot;-//IETF//DTD HTML 2.0//EN\&quot;&gt;' .
				 '&lt;html&gt;&lt;head&gt;' .
				 '&lt;title&gt;500 ' . $resultAry[1] . '&lt;/title&gt;' .
				 '&lt;/head&gt;&lt;body&gt;' .
				 '&lt;h1&gt;500 ' . $resultAry[1] . '&lt;/h1&gt;' .
				 '&lt;hr&gt;' .
				 $_SERVER['SERVER_SIGNATURE'] .
				 '&lt;/body&gt;&lt;/html&gt;';
		print $outputStr;
	}
?&gt;
</pre>
<p>Also here&#8217;s and example of a Flash <strong>crossdomain.xml</strong><em> (this one is reasonably open!)</em> which will be needed in the <strong>root</strong> of your site&#8230;otherwise flex will complain. </p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE cross-domain-policy SYSTEM &quot;http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd&quot;&gt;
&lt;cross-domain-policy&gt;
	&lt;allow-access-from domain=&quot;*&quot; to-ports=&quot;*&quot;/&gt;
	&lt;site-control permitted-cross-domain-policies=&quot;all&quot;/&gt;
&lt;/cross-domain-policy&gt;
</pre>
<p style="text-align: center;"><a rel="nofollow" href="http://bytearray.brixtonjunkies.com/wp-content/uploads/uploader/FlexUploaderExample.html" target="_blank">Demo Flex Uploader</a></p>
<p style="text-align: center;"><a href="http://bytearray.brixtonjunkies.com/wp-content/uploads/2009/10/FlexFileUploader.zip">DOWNLOAD (version 1.0a)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bytearray.brixtonjunkies.com/2009/10/01/flex-multiple-file-uploader/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

