<?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: File upload with CakePHP</title>
	<atom:link href="http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Tue, 31 Jan 2012 15:12:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-215058</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 25 Jul 2011 14:23:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-215058</guid>
		<description>@taqman: Hm, what doesn&#039;t work with the snippet you posted? 

To count the downloads you have to use something like:
&lt;pre&gt;
&lt;code&gt;
$this-&gt;MyFile-&gt;updateAll(array(&#039;MyFile.download_counter&#039;=&gt;&#039;MyFile.download_counter+1&#039;), array(&#039;MyFile.id&#039;=&gt;40)); 
&lt;/code&gt;
&lt;/pre&gt;

Hope this helps!</description>
		<content:encoded><![CDATA[<p>@taqman: Hm, what doesn&#8217;t work with the snippet you posted? </p>
<p>To count the downloads you have to use something like:</p>
<pre>
<code>$this-&gt;MyFile-&gt;updateAll(array('MyFile.download_counter'=&gt;'MyFile.download_counter+1'), array('MyFile.id'=&gt;40));</code>
</pre>
<p>Hope this helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: taqman</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-215004</link>
		<dc:creator>taqman</dc:creator>
		<pubDate>Sun, 24 Jul 2011 22:45:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-215004</guid>
		<description>hi again cakebaker 
I have apply your download function 
 &lt;code&gt;
 function download($id) {
    Configure::write(&#039;debug&#039;, 0);
    if($id != null){
    $file = $this-&gt;Script-&gt;findByid($id);

    header(&#039;Content-type: &#039; . $file[&#039;Attachment&#039;][&#039;file_content_type&#039;]);
    header(&#039;Content-length: &#039; . $file[&#039;Attachment&#039;][&#039;file_size&#039;]); // some people reported problems with this line (see the comments), commenting out this line helped in those cases
    header(&#039;Content-Disposition: attachment; filename=&quot;&#039;.$file[&#039;Attachment&#039;][&#039;file_name&#039;].&#039;&quot;&#039;);
    echo $file[&#039;Attachment&#039;][&#039;file_object&#039;];
     $this-&gt;Session-&gt;setFlash(&#039;Download Complete&#039;);
    exit ();
     $this-&gt;redirect(array($this-&gt;referer()));
    }else{
     $this-&gt;Session-&gt;setFlash(&#039;File not Found&#039;);  
     $this-&gt;redirect(array(&#039;action&#039;=&gt;&#039;script_index&#039;));
    }
}
&lt;/code&gt;
I have question how to fix it to work and I need counter download 
thank</description>
		<content:encoded><![CDATA[<p>hi again cakebaker<br />
I have apply your download function<br />
 <pre><code>function download($id) {
    Configure::write('debug', 0);
    if($id != null){
    $file = $this-&gt;Script-&gt;findByid($id);

    header('Content-type: ' . $file['Attachment']['file_content_type']);
    header('Content-length: ' . $file['Attachment']['file_size']); // some people reported problems with this line (see the comments), commenting out this line helped in those cases
    header('Content-Disposition: attachment; filename="'.$file['Attachment']['file_name'].'"');
    echo $file['Attachment']['file_object'];
     $this-&gt;Session-&gt;setFlash('Download Complete');
    exit ();
     $this-&gt;redirect(array($this-&gt;referer()));
    }else{
     $this-&gt;Session-&gt;setFlash('File not Found');  
     $this-&gt;redirect(array('action'=&gt;'script_index'));
    }
}</code></pre><br />
I have question how to fix it to work and I need counter download<br />
thank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-214727</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 21 Jul 2011 15:06:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-214727</guid>
		<description>@taqman: As I mentioned in my previous comment, I would first check whether your checkType() method gets called. If it is called, I would then check the content of the $data variable, especially the call of array_shift() looks a bit suspicious to me.

Hope this brings you one step further.</description>
		<content:encoded><![CDATA[<p>@taqman: As I mentioned in my previous comment, I would first check whether your checkType() method gets called. If it is called, I would then check the content of the $data variable, especially the call of array_shift() looks a bit suspicious to me.</p>
<p>Hope this brings you one step further.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: taqman</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-214676</link>
		<dc:creator>taqman</dc:creator>
		<pubDate>Wed, 20 Jul 2011 21:13:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-214676</guid>
		<description>@cakebaker thank for answer but your code is useful but the UI 
doesn&#039;t friendly I try to apply to 
http://pixelcone.com/tutorial/ajax-file-upload-using-jquery-and-cakephp-media-plugin/ 
I don&#039;t want media plugin and try to insert you code separate in controller this code  http://bin.cakephp.org/view/1830824100
but when I upload always failed although match in validate 
can you help me to fix it</description>
		<content:encoded><![CDATA[<p>@cakebaker thank for answer but your code is useful but the UI<br />
doesn&#8217;t friendly I try to apply to<br />
<a href="http://pixelcone.com/tutorial/ajax-file-upload-using-jquery-and-cakephp-media-plugin/" rel="nofollow">http://pixelcone.com/tutorial/ajax-file-upload-using-jquery-and-cakephp-media-plugin/</a><br />
I don&#8217;t want media plugin and try to insert you code separate in controller this code  <a href="http://bin.cakephp.org/view/1830824100" rel="nofollow">http://bin.cakephp.org/view/1830824100</a><br />
but when I upload always failed although match in validate<br />
can you help me to fix it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-214648</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Wed, 20 Jul 2011 15:36:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-214648</guid>
		<description>@taqman: Hm, is the checkType() method called? If the method is not called, then the $data array you pass to the save() method probably has the wrong structure. As you can see in the add() method in the article, I have to convert the form data to the structure expected by CakePHP&#039;s save() method.

Hope this helps!</description>
		<content:encoded><![CDATA[<p>@taqman: Hm, is the checkType() method called? If the method is not called, then the $data array you pass to the save() method probably has the wrong structure. As you can see in the add() method in the article, I have to convert the form data to the structure expected by CakePHP&#8217;s save() method.</p>
<p>Hope this helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: taqman</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-214422</link>
		<dc:creator>taqman</dc:creator>
		<pubDate>Tue, 19 Jul 2011 04:41:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-214422</guid>
		<description>&lt;code&gt;
var $validate = array(
            &#039;type&#039; =&gt; array(
               
                &#039;checktypeedit&#039; =&gt;array(
                    &#039;rule&#039; =&gt; array(&#039;checkType&#039;,false),
                    &#039;message&#039; =&gt; &#039;Invalid File type&#039;,

                )
               
                )
);
    function checkType($data, $required = false){
        $data = array_shift($data);
        if(!$required &amp;&amp; $data[&#039;error&#039;] == 4){
            return true;
        }
        $allowedMime = array(&#039;application/x-bittorrent&#039;);
        if(!in_array($data[&#039;type&#039;], $allowedMime)){
            return false;
        }
        return true;
    }
}
 &lt;/code&gt;
it&#039; doesn&#039;t work what is the right way</description>
		<content:encoded><![CDATA[<pre><code>var $validate = array(
            'type' =&gt; array(
               
                'checktypeedit' =&gt;array(
                    'rule' =&gt; array('checkType',false),
                    'message' =&gt; 'Invalid File type',

                )
               
                )
);
    function checkType($data, $required = false){
        $data = array_shift($data);
        if(!$required &amp;&amp; $data['error'] == 4){
            return true;
        }
        $allowedMime = array('application/x-bittorrent');
        if(!in_array($data['type'], $allowedMime)){
            return false;
        }
        return true;
    }
}</code></pre><br />
it&#8217; doesn&#8217;t work what is the right way</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: taqman</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-214388</link>
		<dc:creator>taqman</dc:creator>
		<pubDate>Mon, 18 Jul 2011 17:46:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-214388</guid>
		<description>hi I try to validate file type is doesn&#039;t work
var $validate = array(
            &#039;type&#039; =&gt; array(
               
                &#039;checktypeedit&#039; =&gt;array(
                    &#039;rule&#039; =&gt; array(&#039;checkType&#039;,false),
                    &#039;message&#039; =&gt; &#039;Invalid File type&#039;,

                )
               
                )
);
    function checkType($data, $required = false){
        $data = array_shift($data);
        if(!$required &amp;&amp; $data[&#039;error&#039;] == 4){
            return true;
        }
        $allowedMime = array(&#039;application/x-bittorrent&#039;);
        if(!in_array($data[&#039;type&#039;], $allowedMime)){
            return false;
        }
        return true;
    }</description>
		<content:encoded><![CDATA[<p>hi I try to validate file type is doesn&#8217;t work<br />
var $validate = array(<br />
            &#8216;type&#8217; =&gt; array(</p>
<p>                &#8216;checktypeedit&#8217; =&gt;array(<br />
                    &#8216;rule&#8217; =&gt; array(&#8216;checkType&#8217;,false),<br />
                    &#8216;message&#8217; =&gt; &#8216;Invalid File type&#8217;,</p>
<p>                )</p>
<p>                )<br />
);<br />
    function checkType($data, $required = false){<br />
        $data = array_shift($data);<br />
        if(!$required &amp;&amp; $data['error'] == 4){<br />
            return true;<br />
        }<br />
        $allowedMime = array(&#8216;application/x-bittorrent&#8217;);<br />
        if(!in_array($data['type'], $allowedMime)){<br />
            return false;<br />
        }<br />
        return true;<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kavitha rajendran</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-210802</link>
		<dc:creator>kavitha rajendran</dc:creator>
		<pubDate>Thu, 30 Jun 2011 05:01:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-210802</guid>
		<description>Hi, 
After modifying selenium-api.js file, i have created selenium-server.jar file by following command.
jar -cvf selenium-sevrer.jar selenium-server

But when I am trying to start selenium server, I am getting following error.
D:\krajendr\Desktop\debug&gt;java -jar seleniumserver.jar
Failed to load Main-Class manifest attribute from
seleniumserver.jar

D:\krajendr\Desktop\debug&gt;
please let me know the solution, if anyone knows.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
After modifying selenium-api.js file, i have created selenium-server.jar file by following command.<br />
jar -cvf selenium-sevrer.jar selenium-server</p>
<p>But when I am trying to start selenium server, I am getting following error.<br />
D:\krajendr\Desktop\debug&gt;java -jar seleniumserver.jar<br />
Failed to load Main-Class manifest attribute from<br />
seleniumserver.jar</p>
<p>D:\krajendr\Desktop\debug&gt;<br />
please let me know the solution, if anyone knows.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-200810</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 19 May 2011 15:03:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-200810</guid>
		<description>@SitePunk: You are welcome :)</description>
		<content:encoded><![CDATA[<p>@SitePunk: You are welcome :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SitePunk</title>
		<link>http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/comment-page-4/#comment-200621</link>
		<dc:creator>SitePunk</dc:creator>
		<pubDate>Tue, 17 May 2011 15:25:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakebaker.42dh.com/?p=165#comment-200621</guid>
		<description>Thanks for the tutorial!

@H-man: I had the whitespace on the start of the output as well. I checked my custom App_Controller.php which had an empty space on it&#039;s end. (after the })</description>
		<content:encoded><![CDATA[<p>Thanks for the tutorial!</p>
<p>@H-man: I had the whitespace on the start of the output as well. I checked my custom App_Controller.php which had an empty space on it&#8217;s end. (after the })</p>
]]></content:encoded>
	</item>
</channel>
</rss>

