title: how to fix Call to a member function getClientOriginalExtension() on null in laravel 5.6
body: <p>in my laravel application I am using dropzone programmatically to upload images. this is my Controller to store images in VehicleController</p>
  
  <pre><code>public function store(Request $request)
      {
  
  
      $photos = $request-&gt;file('file');
  
          if (!is_array($photos)) {
              $photos = [$photos];
          }
  
          if (!is_dir($this-&gt;photos_path)) {
              mkdir($this-&gt;photos_path, 0777);
          }
  
          for ($i = 0; $i &lt; count($photos); $i++) {
              $photo = $photos[$i];
              $name = sha1(date('YmdHis') . str_random(30));
              $save_name = $name . '.' . $photo-&gt;getClientOriginalExtension();//this is line 75
              $resize_name = $name . str_random(2) . '.' . $photo-&gt;getClientOriginalExtension();
  
              Image::make($photo)
                  -&gt;resize(250, null, function ($constraints) {
                      $constraints-&gt;aspectRatio();
                  })
                  -&gt;save($this-&gt;photos_path . '/' . $resize_name);
  
              $photo-&gt;move($this-&gt;photos_path, $save_name);
  
              $upload = new Upload();
              $upload-&gt;filename = $save_name;
              $upload-&gt;resized_name = $resize_name;
              $upload-&gt;original_name = basename($photo-&gt;getClientOriginalName());
              $upload-&gt;save();
          }
          return Response::json([
              'message' =&gt; 'Image saved Successfully'
          ], 200);
  </code></pre>
  
  <p>but when my form submit button clicked following errors occurred, </p>
  
  <pre><code>1/1) FatalErrorException
  
  Call to a member function getClientOriginalExtension() on null
  in VehicleController.php line 75
  </code></pre>
  
  <p>how to fix this problem?</p>