<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Multiple File Upload Using AMFPHP</title>
	<atom:link href="http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/</link>
	<description>flex developers web corner</description>
	<lastBuildDate>Wed, 18 Jan 2012 13:28:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: AH-WebDesign</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-2041</link>
		<dc:creator>AH-WebDesign</dc:creator>
		<pubDate>Wed, 15 Jun 2011 16:24:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-2041</guid>
		<description>Greetings:
Im using flash Builder 4 standard and i receive this error after following your instructions
Type1067: Implicit coercion of a value of type __AS3__.vec:Vector. to an unrelated type Array.</description>
		<content:encoded><![CDATA[<p>Greetings:<br />
Im using flash Builder 4 standard and i receive this error after following your instructions<br />
Type1067: Implicit coercion of a value of type __AS3__.vec:Vector. to an unrelated type Array.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arno van Oordt</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-2009</link>
		<dc:creator>Arno van Oordt</dc:creator>
		<pubDate>Sat, 29 Jan 2011 13:52:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-2009</guid>
		<description>@calvin I think &lt;code&gt;_arrUploadFiles[_numCurrentUpload].data.load();&lt;/code&gt; should be &lt;code&gt;_arrUploadFiles[_numCurrentUpload].load();&lt;/code&gt; since load is a method of FileReference and not ByteArray</description>
		<content:encoded><![CDATA[<p>@calvin I think <code>_arrUploadFiles[_numCurrentUpload].data.load();</code> should be <code>_arrUploadFiles[_numCurrentUpload].load();</code> since load is a method of FileReference and not ByteArray</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arno van Oordt</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-2007</link>
		<dc:creator>Arno van Oordt</dc:creator>
		<pubDate>Sat, 29 Jan 2011 13:15:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-2007</guid>
		<description>@calvin I think the load function should be the load function of the FileReferece; so _arrUploadFiles[_numCurrentUpload].data.load();
should be: _arrUploadFiles[_numCurrentUpload].load();</description>
		<content:encoded><![CDATA[<p>@calvin I think the load function should be the load function of the FileReferece; so _arrUploadFiles[_numCurrentUpload].data.load();<br />
should be: _arrUploadFiles[_numCurrentUpload].load();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dl</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-1926</link>
		<dc:creator>dl</dc:creator>
		<pubDate>Tue, 06 Jul 2010 09:44:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-1926</guid>
		<description>Why not just use the Flash Builder built in Zend AMF Dataservices ?
Do we get a progression event when uploading the file so that we can have a progression bar ?</description>
		<content:encoded><![CDATA[<p>Why not just use the Flash Builder built in Zend AMF Dataservices ?<br />
Do we get a progression event when uploading the file so that we can have a progression bar ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrei Ionescu</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-1916</link>
		<dc:creator>Andrei Ionescu</dc:creator>
		<pubDate>Mon, 07 Jun 2010 04:59:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-1916</guid>
		<description>Depending on the server&#039;s OS you can add a cron job (Linux) or a scheduled job (Windows). Create a script that clears everything you want to clear and set it up as a cron job or a schedule job.</description>
		<content:encoded><![CDATA[<p>Depending on the server&#8217;s OS you can add a cron job (Linux) or a scheduled job (Windows). Create a script that clears everything you want to clear and set it up as a cron job or a schedule job.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-1915</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Sun, 06 Jun 2010 23:26:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-1915</guid>
		<description>Hi Andrei.

That&#039;s the best solution all right. 

I write the blob from Oracle into a temporary server folder (directory listing forbidden for security). I then pass the link to the file back to flex and the end-user gets the option to open or save the file.

Working perfect so far but I suppose I&#039;ll need some process to delete the files from the temporary folder at regular intervals.

Thanks,
Steve</description>
		<content:encoded><![CDATA[<p>Hi Andrei.</p>
<p>That&#8217;s the best solution all right. </p>
<p>I write the blob from Oracle into a temporary server folder (directory listing forbidden for security). I then pass the link to the file back to flex and the end-user gets the option to open or save the file.</p>
<p>Working perfect so far but I suppose I&#8217;ll need some process to delete the files from the temporary folder at regular intervals.</p>
<p>Thanks,<br />
Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrei Ionescu</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-1914</link>
		<dc:creator>Andrei Ionescu</dc:creator>
		<pubDate>Sun, 06 Jun 2010 19:36:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-1914</guid>
		<description>Hello Steve!
Please check the size of the after upload. If it&#039;s bigger than zero it means that something has been uploaded and saved in the file. To download it you have to put the location of the &lt;strong&gt;movies.docx&lt;/strong&gt; in the browser and it should download. So is no need to use the &lt;strong&gt;ByteArray&lt;/strong&gt; object from PHP.</description>
		<content:encoded><![CDATA[<p>Hello Steve!<br />
Please check the size of the after upload. If it&#8217;s bigger than zero it means that something has been uploaded and saved in the file. To download it you have to put the location of the <strong>movies.docx</strong> in the browser and it should download. So is no need to use the <strong>ByteArray</strong> object from PHP.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-1913</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Sat, 05 Jun 2010 22:55:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-1913</guid>
		<description>Andrei

Thanks for this excellent example. I got it to work and even modified it to send the uploaded files to blobs in Oracle.

However the problem now is getting the data downloaded back to flex 4.

Even a simple PHP script like
&lt;pre lang=&quot;php&quot;&gt;function downloadFiles() {
    return new ByteArray(file_get_contents(&#039;../../_uploads/movies.docx&#039;));
}&lt;/pre&gt;

is failing with the error: RangeError: Error #2006: The supplied index is out of bounds.

I can&#039;t seem to get a bytearray from amfphp to flex. Any suggestions ?

Thanks!
Steve</description>
		<content:encoded><![CDATA[<p>Andrei</p>
<p>Thanks for this excellent example. I got it to work and even modified it to send the uploaded files to blobs in Oracle.</p>
<p>However the problem now is getting the data downloaded back to flex 4.</p>
<p>Even a simple PHP script like</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> downloadFiles<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #009900;">&#40;</span><span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'../../_uploads/movies.docx'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>is failing with the error: RangeError: Error #2006: The supplied index is out of bounds.</p>
<p>I can&#8217;t seem to get a bytearray from amfphp to flex. Any suggestions ?</p>
<p>Thanks!<br />
Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Claudiu</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-1912</link>
		<dc:creator>Claudiu</dc:creator>
		<pubDate>Fri, 04 Jun 2010 15:56:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-1912</guid>
		<description>change this in the code because the readUTFBytes is failing
&lt;pre lang=&quot;actionscript&quot;&gt;// Called when the load of a file in the application is complete
private function handleFileLoadedComplete(e:Event):void{
    // our file
    var fileRef:FileReference = e.target as FileReference;
    // setting the current file
    _currentUploadingFile = fileRef;
    // reading the content of the file
				
    var encoder:Base64Encoder = new Base64Encoder();
    encoder.encodeBytes(fileRef.data);
				
    var tmpFileContent:String = encoder.toString();				
				
    // calling the server method with the needed 
    // parameters: the filename and the file content
    myUploadService.uploadFiles({filedata: tmpFileContent, filename: fileRef.name});
}&lt;/pre&gt;
on the php side put this line: 
&lt;pre lang=&quot;php&quot;&gt;file_put_contents($myFilePath, base64_decode($fileData[&quot;filedata&quot;]));&lt;/pre&gt;

you should declare the Base64Encoder instance outside the flex function though ...

Happy Uploading
C</description>
		<content:encoded><![CDATA[<p>change this in the code because the readUTFBytes is failing</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// Called when the load of a file in the application is complete</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleFileLoadedComplete<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// our file</span>
    <span style="color: #000000; font-weight: bold;">var</span> fileRef:FileReference = <span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span> as FileReference;
    <span style="color: #808080; font-style: italic;">// setting the current file</span>
    _currentUploadingFile = fileRef;
    <span style="color: #808080; font-style: italic;">// reading the content of the file</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">var</span> encoder:Base64Encoder = <span style="color: #000000; font-weight: bold;">new</span> Base64Encoder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    encoder.<span style="color: #006600;">encodeBytes</span><span style="color: #66cc66;">&#40;</span>fileRef.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">var</span> tmpFileContent:<span style="color: #0066CC;">String</span> = encoder.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;				
&nbsp;
    <span style="color: #808080; font-style: italic;">// calling the server method with the needed </span>
    <span style="color: #808080; font-style: italic;">// parameters: the filename and the file content</span>
    myUploadService.<span style="color: #006600;">uploadFiles</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>filedata: tmpFileContent, filename: fileRef.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>on the php side put this line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">file_put_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myFilePath</span><span style="color: #339933;">,</span> <span style="color: #990000;">base64_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;filedata&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>you should declare the Base64Encoder instance outside the flex function though &#8230;</p>
<p>Happy Uploading<br />
C</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/comment-page-1/#comment-1891</link>
		<dc:creator>James</dc:creator>
		<pubDate>Mon, 10 May 2010 14:45:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/?p=760#comment-1891</guid>
		<description>I tried on Flex 3, when upload image, I trace readUTFBytes return correct bytes but tmpFileContent is trucated, it would only appear to have upload just 3 characters to the server. It was not a problem for non-images format. What is wrong here?</description>
		<content:encoded><![CDATA[<p>I tried on Flex 3, when upload image, I trace readUTFBytes return correct bytes but tmpFileContent is trucated, it would only appear to have upload just 3 characters to the server. It was not a problem for non-images format. What is wrong here?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

