title: validate file size / file type cakephp
body: <p>Hello guys I'm new to cakephp.
  I wanted to validate the file before uploading it, I'v seen some people asking about the same thing. But I don't want custom functions. <strong>Here's the example I DONT WANT</strong>
  <a href="https://stackoverflow.com/questions/3185603/validation-on-a-input-file-in-cakephp">validation on a input file in cakephp</a></p>
  
  <p><strong>and here's the code that I d prefer , but its not working</strong></p>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>class Career extends AppModel 
  {
      public $validate = array(
            'file' =&gt; array(
                  'checktype' =&gt; array(
                      'rule' =&gt; array('extension',array('pdf','doc','docx')),
                      'message' =&gt; 'Please supply a valid file type (PDF OR WORD)',
  
                  ),
                  'checksize' =&gt;array(
                          'rule' =&gt; array('fileSize', '&lt;=', '1MB'),
                          'message' =&gt; 'File must be less than 1MB',
  
                  ),
              ),
        );
   }
  </code></pre>
  
  <p>I also want to add that the file is not mandatory/must, but if you are going to upload it, it must be <em>.pdf/.doc/.docx</em> and less than <em>1MB</em>.</p>
  
  <p>Thank you all</p>