<?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>Subesh Pokhrel&#039;s Blog - Magento Development Tips &#187; fileupload</title>
	<atom:link href="http://subesh.com.np/tag/fileupload/feed/" rel="self" type="application/rss+xml" />
	<link>http://subesh.com.np</link>
	<description>PHP &#38; Magento Tips and Tutorials</description>
	<lastBuildDate>Wed, 01 Feb 2012 04:09:38 +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>Ajaxified File Uploader Using IFrame</title>
		<link>http://subesh.com.np/2008/07/ajaxified-file-uploader-using-iframe/</link>
		<comments>http://subesh.com.np/2008/07/ajaxified-file-uploader-using-iframe/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 12:00:39 +0000</pubDate>
		<dc:creator>Subesh Pokhrel</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[fileupload]]></category>

		<guid isPermaLink="false">http://subesh.com.np/?p=66</guid>
		<description><![CDATA[Today, while writing a code for AJAX file uploader, I was trying to do with [wiki]SALAJAX[/wiki]. But, with SALAJAX I could not manage to send the headers for $_FILES. So I thought of an alternative. And the alternative was to load the action page of the form on [wiki]IFrame[/wiki], whose display would be hidden and [...]]]></description>
			<content:encoded><![CDATA[<p>Today, while writing a code for AJAX file uploader, I was trying to do with [wiki]SALAJAX[/wiki]. But, with <strong>SALAJAX</strong> I could not manage to send the headers for <strong>$_FILES</strong>. So I thought of an alternative. And the alternative was to load the action page of the form on [wiki]IFrame[/wiki], whose display would be hidden and the work for uploading the file will be done on the background without refreshing the page. Yeha.. Its not [wiki]AJAX[/wiki], but it gives a user the feel of asynchronous working on the page. So, my code is <strong>Asynchronous Feel Without Javascript and XML (AFWJAX)</strong>. What do think about this?<br />
So, Here&#8217;s the code.The code below is for the form.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;iframeinc.php&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; id=&quot;uploadform&quot; target=&quot;iframe&quot; name=&quot;uploadform&quot;&gt;
 File:
  &lt;input name=&quot;pic&quot; type=&quot;file&quot; id=&quot;pic&quot; style=&quot;margin-right:50px;&quot; /&gt;
  &lt;br /&gt;
&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Upload&quot; &gt;&lt;br /&gt;
&lt;iframe name=&quot;iframe&quot; src=&quot;iframeinc.php&quot; width=&quot;200&quot; height=&quot;500&quot; style=&quot;display:none;&quot;&gt; &lt;/iframe&gt;
&lt;/form&gt;
</pre>
<p>You can see on <strong>#1</strong> the action of the form is <strong>iframeinc.php</strong>. The code for this page is given below. There are some other things you should remember. Like the <strong>target</strong> for the form is set <strong>iframe</strong>, whose <strong>display</strong> is set <strong>none</strong> so that it is not seen.  And this iframe is the of the iframe created on <strong>#6</strong>, whose source is the <strong>iframeinc.php</strong>. Now here&#8217;s its code.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
if($_POST){

	// $newname is the new path/name of the file on the server.
	$copied = copy($_FILES['pic']['tmp_name'], &quot;$newname&quot;);

}
?&gt;
</pre>
<p>Remember to set <strong>$newname</strong> value before running this. At first run you may see this as a regular post script, but try to reload with f5 or reload button of your browser, you will not be asked to retry or resend the post header. So, there are own ways of catching your nose.<br />
<a href="http://subeshexamples.googlecode.com/files/upload.rar"><strong>[Download Source]</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://subesh.com.np/2008/07/ajaxified-file-uploader-using-iframe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

