title: cakephp 3 upload photo with Josegonzalez/Upload
body: <p>I want to have some photos for my products and tried to use :</p>
  
  <pre><code>Josegonzalez/Upload.Upload
  </code></pre>
  
  <p>but I have some problem with this .
  The field that I specified for image is became required .</p>
  
  <p>and this is the error I get when leave the field empty :</p>
  
  <blockquote>
    <p>This field cannot be left empty</p>
  </blockquote>
  
  <p>when comment the  <code>Josegonzalez/Upload.Upload</code> configurations that field is became optional as it should be !!</p>
  
  <p>this is my configuration :</p>
  
  <pre><code>$this-&gt;addBehavior('Josegonzalez/Upload.Upload' ,
              [
                  'image' =&gt; [
                      'path'              =&gt; 'webroot{DS}img{DS}dynamic' ,
                      'nameCallback' =&gt; function ($data) {
                          $ext = pathinfo($data['name'], PATHINFO_EXTENSION);
                          return rand(100000,999999).time().rand(10000 , 99999).".".$ext;
                      } ,
                      'keepFilesOnDelete' =&gt; false,
                  ] ,
              ]);
  </code></pre>
  
  <p>I also deleted default validation for the field in the table but it doesn't work.</p>
  
  <p>thanks a lot for your help</p>
  
  <p><strong>UPDATE :</strong>
  This is the input  for the photo field before submit</p>
  
  <pre><code>&lt;div class="fileinput fileinput-new" data-provides="fileinput"&gt;
      &lt;div class="fileinput-new thumbnail" style="width: 200px; height: 150px;"&gt;
  
      &lt;/div&gt;
      &lt;div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 10px;"&gt;&lt;/div&gt;
      &lt;div&gt;
                  &lt;span class="btn default btn-file"&gt;
                      &lt;span class="fileinput-new"&gt;chose pic&lt;/span&gt;
                      &lt;span class="fileinput-exists"&gt; edit &lt;/span&gt;
                      &lt;input value="" name="..." type="hidden"&gt;
                      &lt;input name="image" id="image" image="" height="150" width="200" type="file"&gt;
                  &lt;/span&gt;
          &lt;a href="javascript:;" class="btn red fileinput-exists" data-dismiss="fileinput"&gt; حذف &lt;/a&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and this is after i hit submit and the page refreshes with error "This field cannot be left empty"</p>
  
  <pre><code>&lt;div class="fileinput fileinput-new" data-provides="fileinput"&gt;
      &lt;div class="fileinput-new thumbnail" style="width: 200px; height: 150px;"&gt;
          &lt;img src="{my directory}/products/add?error=4&amp;amp;size=0" alt=""&gt;  
      &lt;/div&gt;
      &lt;div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 10px;"&gt;&lt;/div&gt;
      &lt;div&gt;
                  &lt;span class="btn default btn-file"&gt;
                      &lt;span class="fileinput-new"&gt;chose pic&lt;/span&gt;
                      &lt;span class="fileinput-exists"&gt; edit &lt;/span&gt;
                      &lt;input value="" name="..." type="hidden"&gt;
                      &lt;input name="image" required="required" id="image" val=" 4   0" class="form-error" image="&lt;img src=&amp;quot;/Jobs/website/mohammad_parsa/admin/products/add?error=4&amp;amp;amp;size=0&amp;quot; alt=&amp;quot;&amp;quot;/&gt;" height="150" width="200" type="file"&gt;
                  &lt;/span&gt;
          &lt;a href="javascript:;" class="btn red fileinput-exists" data-dismiss="fileinput"&gt; حذف &lt;/a&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>