title: Dropzone and non-object error
body: <p>I'm trying to implement dropzonejs file upload on my website, but I'm getting this error</p>
  
  <pre><code>{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to a member function isValid() on a non-object","file":"C:\\Users\\Username\\Desktop\\localhost\\Project\\app\\controllers\\FileController.php","line":147}}
  </code></pre>
  
  <p>I have this inside the head tag. I check if the file is an Image and then check the dimensions before sending the file in to the controller. If the file is not an image I send it straight to the controller.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(function() {
      Dropzone.options.createFile = {
        accept: function(file, done) {
          // checking if the filetype is an image to check the dimensions
          if ((/\.(gif|jpg|jpeg|tiff|png)$/i).test(file.name)) {              
            var pixels = 0;
            var reader = new FileReader();
            reader.onload = (function(file) {
            var image = new Image();
            image.src = file.target.result;
            image.onload = function() {
              width = this.width;
              height = this.height;
              if(width &lt; 800 || height &lt; 300) {
                done('image is not 800x300 pixels!'); 
              } else {
                done(); 
              } 
            }; 
            }); 
            reader.readAsDataURL(file);               
          } else {
            // if the file is not an image
            done();
          }
        },
        url: '/process/create-file',
        previewsContainer: ".dropzone-previews",
        uploadMultiple: true,
        parallelUploads: 100,
        maxFiles: 100,
      }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>This is the stripped controller, I removed a chunk of the code to make it shorter. Because the error is right at the top.</p>
  
  <pre><code>public function postCreateFile()
  {
      if(!Input::hasFile('file'))
      return Response::json('Where is the file?', 400);
  
      $file = Input::file('file');
      if($file-&gt;isValid()){
          // do stuff
      }
  }
  </code></pre>
  
  <p>if I add <code>return var_dump($file)</code> before the <code>$file-&gt;isValid()</code> line I get this response</p>
  
  <pre><code>array (size=2)  '_token' =&gt; string 'BtN7aFkEUQvXlaJDzxx28e4WMI08h5bl3VqrEaHR' (length=40)  'file' =&gt;     array (size=1)      0 =&gt;         object(Symfony\Component\HttpFoundation\File\UploadedFile)[9]          private 'test' =&gt; boolean false          private 'originalName' =&gt; string '65VWl.jpg' (length=9)          private 'mimeType' =&gt; string 'image/jpeg' (length=10)          private 'size' =&gt; int 260740          private 'error' =&gt; int 0
  </code></pre>
  
  <p>And here is the form. I have enctype and files set to true, but still I get an error with a message "non-object" as described above.</p>
  
  <pre><code>{{ Form::open(array('class' =&gt; 'dropzone', 'id' =&gt; 'create-file', 'url' =&gt; 'process/create-file', 'enctype' =&gt; 'multipart/form-data', 'files' =&gt; true)) }}
      &lt;div class="dropzone-previews" id="giga-drop"&gt;
          &lt;div class="fallback"&gt;
          {{ Form::file('file') }}
          &lt;/div&gt;
      &lt;/div&gt;
  {{ Form::close() }}
  </code></pre>
  
  <p>Any ideas why am I getting this error?</p>