How to overcome getClientOriginalName() error in Laravel dropzone file upload?
<p>I am using Laravel 5.0, for image uploading I am using dropzone.js. Actually file uploading to folder and database but it is throwing error like </p>

<blockquote>
  <p>Call to a member function getClientOriginalName() on a non-object
  on post method.</p>
</blockquote>

<p>Where have I gone wrong?</p>

<p>View File,</p>

<pre><code>&lt;form  method="POST" class="dropzone dz-clickable" id="productDropzone" action="{{url()}}/cms/website/pages/upload_files" enctype="multipart/form-data"&gt;
                              &lt;div class="dz-default dz-message"&gt;
                                &lt;span&gt;Drop files here to upload&lt;/span&gt;
                              &lt;/div&gt;
                              &lt;input name="_token" type="hidden" value="{{ csrf_token() }}"&gt;
                            &lt;input type="submit" value="Upload" id="submit_all"/&gt;
                          &lt;/form&gt;
</code></pre>

<p>Below is my js,</p>

<pre><code>Dropzone.autoDiscover = false;
var myDropzone = new Dropzone("form#productDropzone", { 
    paramName : 'file',
    maxFilesize: 3, // MB
    maxFiles: 3,
    autoProcessQueue: false,
    addRemoveLinks: true,
    init: function() {
        this.on("addedfile", function(file) { fileupload_flag = 1; });
        this.on("complete", function(file) { fileupload_flag = 0; });
    },
    accept: function(file, done) 
   {
        var re = /(?:\.([^.]+))?$/;
        var ext = re.exec(file.name)[1];
        ext = ext.toUpperCase();
        if ( ext == "JPG" || ext == "JPEG" || ext == "PNG" ||  ext == "GIF" ||  ext == "BMP") 
        {
            done();
        }else { 
            done("Please select only supported picture files."); 
        }
    },
    success: function( file, response ) {
      obj = JSON.parse(response);
      file.previewElement.querySelector("file").src = obj.src;
      // alert(obj.src);return false;
    }
});
$('#submit_all').click(function(){   
  myDropzone.processQueue();
});
</code></pre>

<p>Controller function,</p>

<pre><code>   $com_id     = Auth::user()-&gt;company_id; 

   $file = Request::file('file');
        $destinationPath = public_path() . '/images/section/';
        $filename = strtolower($file-&gt;getClientOriginalName());

        $upload_success = $file-&gt;move($destinationPath, $filename);

        if ($upload_success) {

            $upload = new Cms_banner_master();
            $upload-&gt;product_banner = json_encode($filename);
            $upload-&gt;company_id = $com_id;
            $upload-&gt;home_banner ="1";
            $upload-&gt;save();

            return Response::json(array($fileName));
            } else 
            {
            return Response::json('error', 400);

        }
</code></pre>