<?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: MeioUpload Behavior 1.0.1 released!</title>
	<atom:link href="http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/</link>
	<description>A peça que faltava para seu código.</description>
	<lastBuildDate>Thu, 02 Feb 2012 22:11:34 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Francis Rebouças</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-9415</link>
		<dc:creator>Francis Rebouças</dc:creator>
		<pubDate>Mon, 07 Sep 2009 17:20:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-9415</guid>
		<description>&lt;p&gt;Olá Vinicius....
Muito bom o seu behavior, sou um novo aventureiro do CakePHP, meu problema é o seguinte tenho que enviar uma lista de imagens de uma só vez pelo seu Behavior, por isso optei por um flash que cria a lista e as envia. As informações do arquivo fica em um $_FILES[&#039;Filedata&#039;].&lt;/p&gt;

&lt;p&gt;Meu Código:
if (!empty($_FILES[&quot;Filedata&quot;])) {
  $this-&gt;Imagem-&gt;create();
  $this-&gt;data[&#039;Imagem&#039;][&#039;imagem&#039;][&#039;name&#039;] = $_FILES[&#039;Filedata&#039;][&#039;name&#039;];
  $this-&gt;data[&#039;Imagem&#039;][&#039;imagem&#039;][&#039;type&#039;] = $_FILES[&#039;Filedata&#039;][&#039;type&#039;];
  $this-&gt;data[&#039;Imagem&#039;][&#039;imagem&#039;][&#039;tmp_name&#039;] = $_FILES[&#039;Filedata&#039;][&#039;tmp_name&#039;];
  $this-&gt;data[&#039;Imagem&#039;][&#039;imagem&#039;][&#039;error&#039;] = $_FILES[&#039;Filedata&#039;][&#039;error&#039;];
  $this-&gt;data[&#039;Imagem&#039;][&#039;imagem&#039;][&#039;size&#039;] = $_FILES[&#039;Filedata&#039;][&#039;size&#039;];
  $this-&gt;Imagem-&gt;save($this-&gt;data);
}&lt;/p&gt;

&lt;p&gt;Mas ele não resulta em nada. Não guarda nada em DB nem faz upload.&lt;/p&gt;

&lt;p&gt;Obrigado&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Olá Vinicius&#8230;.
Muito bom o seu behavior, sou um novo aventureiro do CakePHP, meu problema é o seguinte tenho que enviar uma lista de imagens de uma só vez pelo seu Behavior, por isso optei por um flash que cria a lista e as envia. As informações do arquivo fica em um $_FILES['Filedata'].</p>

<p>Meu Código:
if (!empty($_FILES["Filedata"])) {
  $this-&gt;Imagem-&gt;create();
  $this-&gt;data['Imagem']['imagem']['name'] = $_FILES['Filedata']['name'];
  $this-&gt;data['Imagem']['imagem']['type'] = $_FILES['Filedata']['type'];
  $this-&gt;data['Imagem']['imagem']['tmp_name'] = $_FILES['Filedata']['tmp_name'];
  $this-&gt;data['Imagem']['imagem']['error'] = $_FILES['Filedata']['error'];
  $this-&gt;data['Imagem']['imagem']['size'] = $_FILES['Filedata']['size'];
  $this-&gt;Imagem-&gt;save($this-&gt;data);
}</p>

<p>Mas ele não resulta em nada. Não guarda nada em DB nem faz upload.</p>

<p>Obrigado</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Vinicius Mendes</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-6077</link>
		<dc:creator>Vinicius Mendes</dc:creator>
		<pubDate>Mon, 27 Oct 2008 15:57:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-6077</guid>
		<description>&lt;p&gt;Hmm, good idea. I will do this. An option, if empty, don&#039;t set permissions, else set the permission based in this string. The default will be it empty.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hmm, good idea. I will do this. An option, if empty, don&#8217;t set permissions, else set the permission based in this string. The default will be it empty.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: ADmad</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-6075</link>
		<dc:creator>ADmad</dc:creator>
		<pubDate>Sun, 26 Oct 2008 10:12:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-6075</guid>
		<description>&lt;p&gt;Setting fixed file permissions is not a good idea. Keep it configurable so that permissions can be set as required based on server needs.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Setting fixed file permissions is not a good idea. Keep it configurable so that permissions can be set as required based on server needs.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Vinicius Mendes</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-6074</link>
		<dc:creator>Vinicius Mendes</dc:creator>
		<pubDate>Fri, 24 Oct 2008 02:08:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-6074</guid>
		<description>&lt;p&gt;Kanoa, thanks for the contribution, I will add this piece of code in the behavior.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Kanoa, thanks for the contribution, I will add this piece of code in the behavior.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: kanoa</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-6071</link>
		<dc:creator>kanoa</dc:creator>
		<pubDate>Thu, 23 Oct 2008 16:42:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-6071</guid>
		<description>&lt;p&gt;Nice work, I was suffering from corrupted uploads on MAMP running OSX10.5.3. Inserting this block of code at line 636 to set the permissions of the uploaded file fixed the problem:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;        // change the permissions of the uploaded file
        if(!chmod( $saveAs, 0644 ) ) {
            $model-&gt;validationErrors[$field] = &#039;Correct permissions could not be set on the uploaded file&#039;;
            return false;
        }
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>Nice work, I was suffering from corrupted uploads on MAMP running OSX10.5.3. Inserting this block of code at line 636 to set the permissions of the uploaded file fixed the problem:</p>

<pre><code>        // change the permissions of the uploaded file
        if(!chmod( $saveAs, 0644 ) ) {
            $model-&amp;gt;validationErrors[$field] = 'Correct permissions could not be set on the uploaded file';
            return false;
        }
</code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Vinicius Mendes</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-6070</link>
		<dc:creator>Vinicius Mendes</dc:creator>
		<pubDate>Thu, 23 Oct 2008 12:54:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-6070</guid>
		<description>&lt;p&gt;Hehe&lt;/p&gt;

&lt;p&gt;thanks for the help. Fell free to make as many rouds as you want. I will see this invalidate function. And about the arrays, I will keep just the $default_validations, Since it merges both. I don&#039;t removed the $default_options[&#039;validations&#039;] just to keep the backwards compatibility.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hehe</p>

<p>thanks for the help. Fell free to make as many rouds as you want. I will see this invalidate function. And about the arrays, I will keep just the $default_validations, Since it merges both. I don&#8217;t removed the $default_options['validations'] just to keep the backwards compatibility.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: ADmad</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-6069</link>
		<dc:creator>ADmad</dc:creator>
		<pubDate>Thu, 23 Oct 2008 08:19:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-6069</guid>
		<description>&lt;p&gt;Comments round 2 :)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In beforeSave when attempting to move uploaded file don&#039;t set the error message directly to validationErrors array . Instead use the Model-&gt;invalidate function. Many people override this function for il8n and translate the message string first before setting to validationErrors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not important but declaring the default validation errors twice as $default_options[&#039;validations&#039;] and as $default_validations seems a bit redundant. You can just have $default_options[&#039;validations&#039;] and assign it to $default_validations in setup() if needed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
		<content:encoded><![CDATA[<p>Comments round 2 <img src='http://www.meiocodigo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<ul>
<li><p>In beforeSave when attempting to move uploaded file don&#8217;t set the error message directly to validationErrors array . Instead use the Model-&gt;invalidate function. Many people override this function for il8n and translate the message string first before setting to validationErrors.</p></li>
<li><p>Not important but declaring the default validation errors twice as $default_options['validations'] and as $default_validations seems a bit redundant. You can just have $default_options['validations'] and assign it to $default_validations in setup() if needed.</p></li>
</ul>]]></content:encoded>
	</item>
	<item>
		<title>By: Vinicius Mendes</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-6045</link>
		<dc:creator>Vinicius Mendes</dc:creator>
		<pubDate>Sat, 11 Oct 2008 22:46:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-6045</guid>
		<description>&lt;p&gt;Thank&#039;s for the comment, I will take note of these suggestions and analyze the possibility of implementing them. I saw the Set::merge function a little while after publishing the behavior but already changed the code to use it, I will publish it soon.&lt;/p&gt;

&lt;p&gt;About the validation, I&#039;m thinking about changing some things in it. Maybe use the var $validate of the model to apply the validation rules. I think it is more related to the work the framework is doing.&lt;/p&gt;

&lt;p&gt;And about the bakery, I&#039;m trying to have time to do this. Anyway, thanks for the comment again.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thank&#8217;s for the comment, I will take note of these suggestions and analyze the possibility of implementing them. I saw the Set::merge function a little while after publishing the behavior but already changed the code to use it, I will publish it soon.</p>

<p>About the validation, I&#8217;m thinking about changing some things in it. Maybe use the var $validate of the model to apply the validation rules. I think it is more related to the work the framework is doing.</p>

<p>And about the bakery, I&#8217;m trying to have time to do this. Anyway, thanks for the comment again.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: ADmad</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-6043</link>
		<dc:creator>ADmad</dc:creator>
		<pubDate>Sat, 11 Oct 2008 14:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-6043</guid>
		<description>&lt;p&gt;Nice work. You have done a fine job improving upon the work of the previous authors. A few comments:
- Didn&#039;t core&#039;s Set::merge work for you instead of you custom recursive merge function ?
- Not that it matters much but I think a more appropriate location to merge validation rules with the model&#039;s $validate would be beforeValidate callback.
- You should submit this fine piece of work to the bakery. Its deserves more exposure :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nice work. You have done a fine job improving upon the work of the previous authors. A few comments:
- Didn&#8217;t core&#8217;s Set::merge work for you instead of you custom recursive merge function ?
- Not that it matters much but I think a more appropriate location to merge validation rules with the model&#8217;s $validate would be beforeValidate callback.
- You should submit this fine piece of work to the bakery. Its deserves more exposure <img src='http://www.meiocodigo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: vbmendes</title>
		<link>http://www.meiocodigo.com/2008/10/12/meioupload-behavior-10-released/comment-page-1/#comment-6032</link>
		<dc:creator>vbmendes</dc:creator>
		<pubDate>Mon, 06 Oct 2008 02:23:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.meiocodigo.com/?p=135#comment-6032</guid>
		<description>&lt;p&gt;Obrigado pelo reconhecimento. Qualquer dúvida é só falar.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Obrigado pelo reconhecimento. Qualquer dúvida é só falar.</p>]]></content:encoded>
	</item>
</channel>
</rss>

