<?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>Mukesh Chapagain&#039;s Blog &#187; file</title>
	<atom:link href="http://blog.chapagain.com.np/tag/file/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.chapagain.com.np</link>
	<description>PHP Magento jQuery Wordpress Javascript programming n tutorial</description>
	<lastBuildDate>Tue, 07 Sep 2010 06:18:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Magento: How to upload file?</title>
		<link>http://blog.chapagain.com.np/magento-how-to-upload-file/</link>
		<comments>http://blog.chapagain.com.np/magento-how-to-upload-file/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 04:15:42 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=587</guid>
		<description><![CDATA[In adminhtml, you might have the following code in any form. Here &#8216;logo&#8216; is the name of the input type file. Or, you may have any HTML Form with the File field in the frontend page. Remember that your form&#8217;s enctype should be multipart/form-data. 

$fieldset-&#62;addField('logo', 'file', array(
	'label'     =&#62; 'Small Logo',
	'required'  =&#62; false,
	'name'      =&#62; 'logo',
));


You can easily upload file using Varien_File_Uploader class. The class file path is lib/Varien/File/Uploader.php.
- In the code below, the file field name is &#8216;logo&#8216;.
- You can add ...


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/multiple-file-upload-with-jquery-and-php/' rel='bookmark' title='Permanent Link: Multiple file upload with jQuery and php'>Multiple file upload with jQuery and php</a></li>
<li><a href='http://blog.chapagain.com.np/file-upload-in-php-simplified/' rel='bookmark' title='Permanent Link: File Upload in PHP :: Simplified'>File Upload in PHP :: Simplified</a></li>
<li><a href='http://blog.chapagain.com.np/file-upload-in-pear-and-smarty/' rel='bookmark' title='Permanent Link: File Upload in PEAR and Smarty'>File Upload in PEAR and Smarty</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In adminhtml, you might have the following code in any form. Here &#8216;<strong>logo</strong>&#8216; is the name of the input type file. Or, you may have any HTML Form with the File field in the frontend page. Remember that your form&#8217;s <strong>enctype </strong>should be <strong>multipart/form-data</strong>. </p>
<pre class="brush: php;">
$fieldset-&gt;addField('logo', 'file', array(
	'label'     =&gt; 'Small Logo',
	'required'  =&gt; false,
	'name'      =&gt; 'logo',
));
</pre>
<p><span id="more-587"></span></p>
<p>You can easily upload file using <strong>Varien_File_Uploader</strong> class. The class file path is <strong>lib/Varien/File/Uploader.php</strong>.</p>
<p>- In the code below, the file field name is &#8216;<strong>logo</strong>&#8216;.<br />
- You can add or remove allowed extension for upload through <strong>setAllowedExtensions </strong>function.<br />
- If <strong>setAllowRenameFiles </strong>function&#8217;s parameter is set true, then the uploaded file name will be changed if some file with the same name already exists in the destination directory.<br />
- The file is uploaded in <strong>media </strong>directory. You can add your own directory there. But remember that your directory should be writable.<br />
- save function is used to save the file with a specific name and to a specific path.</p>
<pre class="brush: php;">
if (isset($_FILES['logo']['name']) &amp;&amp; $_FILES['logo']['name'] != '') {
	try {
		$uploader = new Varien_File_Uploader('logo');
		$uploader-&gt;setAllowedExtensions(array('jpg','jpeg','gif','png'));
		$uploader-&gt;setAllowRenameFiles(false);
		$uploader-&gt;setFilesDispersion(false);
		$path = Mage::getBaseDir('media') . DS;
		// $path = Mage::getBaseDir('media') . DS . 'logo' . DS;
		$logoName = $_FILES['logo']['name'];
		$uploader-&gt;save($path, $logoName);

	} catch (Exception $e) {

	}
}
</pre>
<p>Hope this helps. Thanks for reading.</p>
<div style="margin-top: 15px; font-style: italic">
<p><strong>From</strong> <a href="http://blog.chapagain.com.np/">Mukesh Chapagain&#039;s Blog</a> | <strong>Post</strong> <a href="http://blog.chapagain.com.np/magento-how-to-upload-file/">Magento: How to upload file?</a></p>
</div>
<hr /><small>Copyright &copy; 2010<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=587&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/multiple-file-upload-with-jquery-and-php/' rel='bookmark' title='Permanent Link: Multiple file upload with jQuery and php'>Multiple file upload with jQuery and php</a></li>
<li><a href='http://blog.chapagain.com.np/file-upload-in-php-simplified/' rel='bookmark' title='Permanent Link: File Upload in PHP :: Simplified'>File Upload in PHP :: Simplified</a></li>
<li><a href='http://blog.chapagain.com.np/file-upload-in-pear-and-smarty/' rel='bookmark' title='Permanent Link: File Upload in PEAR and Smarty'>File Upload in PEAR and Smarty</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-how-to-upload-file/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Multiple file upload with jQuery and php</title>
		<link>http://blog.chapagain.com.np/multiple-file-upload-with-jquery-and-php/</link>
		<comments>http://blog.chapagain.com.np/multiple-file-upload-with-jquery-and-php/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 07:59:08 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[multiple]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=125</guid>
		<description><![CDATA[Here, I am going to show you how easy it is to upload multiple files with the help of jQuery and PHP.
I suppose that you are familiar with php and apache web server.

Let our folder name be &#8216;test&#8217;. Let us create a file called &#8216;index.php&#8217; inside test folder. Inside the &#8216;test&#8217; folder, you have to make another folder named &#8216;uploads&#8217;. The files will be uploaded into this folder.
We need few more things. We need the jQuery js files. Download the following two files and keep inside the folder &#8216;test&#8217;.
http://jquery.com/src/jquery-latest.js
http://jquery-multifile-plugin.googlecode.com/svn/trunk/jquery.MultiFile.js
Below is ...


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/file-upload-in-php-simplified/' rel='bookmark' title='Permanent Link: File Upload in PHP :: Simplified'>File Upload in PHP :: Simplified</a></li>
<li><a href='http://blog.chapagain.com.np/file-upload-in-pear-and-smarty/' rel='bookmark' title='Permanent Link: File Upload in PEAR and Smarty'>File Upload in PEAR and Smarty</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-upload-file/' rel='bookmark' title='Permanent Link: Magento: How to upload file?'>Magento: How to upload file?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Here, I am going to show you how easy it is to upload multiple files with the help of jQuery and PHP.</p>
<p>I suppose that you are familiar with php and apache web server.</p>
<p><span id="more-125"></span></p>
<p>Let our folder name be &#8216;test&#8217;. Let us create a file called &#8216;index.php&#8217; inside test folder. Inside the &#8216;test&#8217; folder, you have to make another folder named &#8216;uploads&#8217;. The files will be uploaded into this folder.</p>
<p>We need few more things. We need the jQuery js files. Download the following two files and keep inside the folder &#8216;test&#8217;.</p>
<p>http://jquery.com/src/jquery-latest.js</p>
<p>http://jquery-multifile-plugin.googlecode.com/svn/trunk/jquery.MultiFile.js</p>
<p>Below is the complete code for multiple file upload:</p>
<pre class="brush: php;">&lt;?php
if(isset($_POST['upload']))
{
    $uploaddir = 'uploads/';
    foreach ($_FILES[&quot;pic&quot;][&quot;error&quot;] as $key =&gt; $error)
    {
        if ($error == UPLOAD_ERR_OK)
        {
            $tmp_name = $_FILES[&quot;pic&quot;][&quot;tmp_name&quot;][$key];
            $name = $_FILES[&quot;pic&quot;][&quot;name&quot;][$key];
            $uploadfile = $uploaddir . basename($name);

            if (move_uploaded_file($tmp_name, $uploadfile))
            {
                echo &quot;Success: File &quot;.$name.&quot; uploaded.&lt;br/&gt;&quot;;
            }
            else
            {
                echo &quot;Error: File &quot;.$name.&quot; cannot be uploaded.&lt;br/&gt;&quot;;
            }
        }
    }
}
?&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Multiple File Upload with jQuery and PHP&lt;/title&gt;

&lt;script src=&quot;jquery.js&quot; type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;jquery.MultiFile.js&quot; type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;
&lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
&lt;input type=&quot;file&quot; name=&quot;pic[]&quot; class=&quot;multi&quot; /&gt;
&lt;input type=&quot;submit&quot; name=&quot;upload&quot; value=&quot;Upload&quot; /&gt;
&lt;/form&gt;
&lt;/body&gt;

&lt;/html&gt;</pre>
<p>There is one important thing to be noticed.</p>
<pre class="brush: xml;">
&lt;input type=&quot;file&quot; name=&quot;pic[]&quot; class=&quot;multi&quot; /&gt;
</pre>
<p>You have add &#8220;[ ]&#8221; to name of your element. And you also have to add class=&#8221;multi&#8221;.</p>
<p>For more examples, see:</p>
<p>http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Examples
<div style="margin-top: 15px; font-style: italic">
<p><strong>From</strong> <a href="http://blog.chapagain.com.np/">Mukesh Chapagain&#039;s Blog</a> | <strong>Post</strong> <a href="http://blog.chapagain.com.np/multiple-file-upload-with-jquery-and-php/">Multiple file upload with jQuery and php</a></p>
</div>
<hr /><small>Copyright &copy; 2010<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=125&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/file-upload-in-php-simplified/' rel='bookmark' title='Permanent Link: File Upload in PHP :: Simplified'>File Upload in PHP :: Simplified</a></li>
<li><a href='http://blog.chapagain.com.np/file-upload-in-pear-and-smarty/' rel='bookmark' title='Permanent Link: File Upload in PEAR and Smarty'>File Upload in PEAR and Smarty</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-upload-file/' rel='bookmark' title='Permanent Link: Magento: How to upload file?'>Magento: How to upload file?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/multiple-file-upload-with-jquery-and-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
