title: SQL array to string conversion error cakephp
body: <p>I am facing this weird problem here with file upload.
  So when I upload the file everything goes fine. But when I don't select anyfile in upload and submit the form I get following error:</p>
  
  <pre><code>Notice (8): Array to string conversion [CORE\cake\libs\model\datasources\dbo_source.php, line 749]
  
  Warning (512): SQL Error: 1054: Unknown column 'Array' in 'field list' [CORE\cake\libs\model\datasources\dbo_source.php, line 684]
  
  Query: INSERT INTO `masters` (`candidate_id`, `candidate_name`, `candidate_file_name`) VALUES ('heman', 'He Man', Array)
  </code></pre>
  
  <p>Now here is what I am doing: in my controller:</p>
  
  <p>The function which makes call to file upload function:</p>
  
  <pre><code>            if ( $_FILES['data']['name']['Master'])
              {
                  $this-&gt;upload_files();
              }
  </code></pre>
  
  <p>Here is the file upload function:</p>
  
  <pre><code>function upload_files() {
  
      $fcnt = 0;
      $vdata = $_FILES['data']['name']['Master'];
              echo "Vdata:";
              pr($vdata);
      foreach ( $vdata as $v ) 
      {
          $pro_files[] = array(
              'name'=&gt;$_FILES['data']['name']['Master']['candidate_file_name'],
              'tmp'=&gt;$_FILES['data']['tmp_name']['Master']['candidate_file_name'],
              'type'=&gt;$_FILES['data']['type']['Master']['candidate_file_name'],
  
          );  
          echo "Pro_files:";
          pr($pro_files);
          $fcnt++;
      }
  
      $cnt = 0;
  
      $allowed = array(
          'xls','xlsx','db','mbd',
          'txt','pdf','doc','docx',
          'log','rtf','wpd','wps',
          'csv','dat','pps','ppt',
          'pptx','sdf','xml','bmp',
          'gif','jpg','png','psd',
          'thm','tif','svg','sql',
          'html','htm','js','php',
          'bin','mim','7z','deb',
          'gz','pkg','sit',
          'sitx','tar.gz','zip',
          'zipx','pdf'
      );
  
      foreach ( $pro_files as $file )
      {
          $fileType = $file['type'];
          $fileType2 = explode('/',$fileType);
          $fileName = $file['name'];
          $path = 'C:\wamp\www' . '\\' . $fileName;
          //if ( in_array($fileType2[1],$allowed)) 
          //{
          echo "fileName";    
          pr($fileName);
              if ( move_uploaded_file($file["tmp"], $path) )
              {
                  $this-&gt;data['Master']['candidate_file_name'] = $fileName;
              }
  
          //}
  
          $cnt++;
      }
  
  }
  </code></pre>
  
  <p>Here is how my debug data looks like:</p>
  
  <pre><code>  Array
    (
      [Master] =&gt; Array
          (
              [candidate_id] =&gt; heman
              [candidate_name] =&gt; He Man
              [candidate_file_name] =&gt; Array
                  (
                      [name] =&gt; test.txt
                      [type] =&gt; text/plain
                      [tmp_name] =&gt; C:\wamp\tmp\php329D.tmp
                      [error] =&gt; 0
                      [size] =&gt; 0
                  )
  
          )
  
    )
  </code></pre>
  
  <p>Here is how vdata looks like:</p>
  
  <pre><code>Array
  (
      [candidate_file_name] =&gt; 
  )
  </code></pre>
  
  <p>here is how profiles looks like</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [name] =&gt; 
              [tmp] =&gt; 
              [type] =&gt; 
          )
  
  )
  </code></pre>
  
  <p>filename comes out to be nothing.</p>
  
  <p>here is how the pr($_FILES) looks like:</p>
  
  <pre><code>Array
  (
      [data] =&gt; Array
          (
              [name] =&gt; Array
                  (
                      [Master] =&gt; Array
                          (
                              [candidate_file_name] =&gt; 
                          )
  
                  )
  
              [type] =&gt; Array
                  (
                      [Master] =&gt; Array
                          (
                              [candidate_file_name] =&gt; 
                          )
  
                  )
  
              [tmp_name] =&gt; Array
                  (
                      [Master] =&gt; Array
                          (
                              [candidate_file_name] =&gt; 
                          )
  
                  )
  
              [error] =&gt; Array
                  (
                      [Master] =&gt; Array
                          (
                              [candidate_file_name] =&gt; 4
                          )
  
                  )
  
              [size] =&gt; Array
                  (
                      [Master] =&gt; Array
                          (
                              [candidate_file_name] =&gt; 0
                          )
  
                  )
  
          )
  
  )
  </code></pre>
  
  <p>I am not able to figure out what the problem might be.
  Can anyone help?
  Your help is much appreciated.
  Thanks,</p>