title: Chunk upload does not work with large files - Laravel 5.8
body: <p>I need to upload large files to my site, and to do this, I used the <strong>Dropzone JS</strong>, with <a href="https://packagist.org/packages/pion/laravel-chunk-upload" rel="nofollow noreferrer">pion/laravel-chunk-upload</a>, I do not understand, everything is good and true, but although this, any upload for large files is not completed, when uploading small files, I get a result, but When I try with larger files eg 5MB, </p>
  
  <ul>
  <li><strong>It stops at a part of uploading</strong> for Hosts eg (Hostinger)</li>
  <li>does <strong>not work</strong> and gives <strong>an error from laravel <em>validator</em></strong> for WampServer 4 (localhost)</li>
  </ul>
  
  <blockquote>
    <p>I tried here to remove my Validator, but the same problem, I can't
    upload or check if is a valid file or something like that! (for localhost)</p>
  </blockquote>
  
  <p>I tried a lot but I do not understand the problem and can't find a solution, please help, this is my code:</p>
  
  <p><strong>My view:</strong> </p>
  
  <pre><code>&lt;form action="{{ route('files') }}" enctype="multipart/form-data" class="dropzone" id="fileupload" method="POST"&gt;
        @csrf
        &lt;input type="hidden" name="item_id" value="{{ $item-&gt;id }}"&gt;
        &lt;div class="fallback"&gt;
             &lt;input name="file" type="files" multiple /&gt;
        &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>// UPLOAD FILES 
      protected function uploadFiles(Request $request) {
          $validator = Validator::make($request-&gt;all(), [
              'file' =&gt; 'required|max:3145730', // 3GB
              'item_id' =&gt; 'required|numeric'
          ]);
  
          $item_id = $request-&gt;item_id;
          $item_data = Item::whereId($item_id)-&gt;where('user_id', Auth::id())-&gt;whereStatus(0)-&gt;first();
  
          if (!$item_data || $validator-&gt;fails()) {
              return response()-&gt;json([
                  'status' =&gt; true,
                  'error' =&gt; 'Invalid data!'
              ], 401); 
          }
  
          if ($request-&gt;hasFile('file')) { 
              # CHECK IF IS FILE
              if ($request-&gt;file('file')-&gt;isValid()) {
                  $file = $request-&gt;file('file');
                  # UPLOAD
                  $type = strtolower($file-&gt;getClientOriginalExtension());
                  $mime = $file-&gt;getMimeType();
                  $size = $file-&gt;getSize();
                  $width = null;
                  $height = null;
  
                  if (!in_array($type, ['png', 'jpeg', 'jpg', 'zip']) || !in_array($mime, ['application/octet-stream', 'application/zip', 'image/jpg', 'image/png', 'image/jpeg'])) {
                      return response()-&gt;json([
                          'status' =&gt; true,
                          'error' =&gt; 'You can\'t upload files of this type.'
                      ], 401); 
                  }
  
                  // create the file receiver
                  $receiver = new FileReceiver("file", $request, HandlerFactory::classFromRequest($request));
                  // check if the upload is success, throw exception or return response you need
                  if ($receiver-&gt;isUploaded() === false) {
                      throw new UploadMissingFileException();
                  }
                  // receive the file
                  $save = $receiver-&gt;receive();
                  // check if the upload has finished (in chunk mode it will send smaller files)
                  if ($save-&gt;isFinished()) {
                      // save the file and return any response you need, current example uses `move` function. If you are
                      // not using move, you need to manually delete the file by unlink($save-&gt;getFile()-&gt;getPathname())
                      if (in_array($type, ['png', 'jpeg', 'jpg'])) {
                          list($width, $height) = getimagesize($file);
                      }
                      return $this-&gt;saveFile($save-&gt;getFile(), $item_id, $type, $mime, $size, $width, $height);
                  }
                  // we are in chunk mode, lets send the current progress
                  /** @var AbstractHandler $handler */
                  $handler = $save-&gt;handler();
                  return response()-&gt;json([
                      "done" =&gt; $handler-&gt;getPercentageDone(),
                      'status' =&gt; true
                  ]);
              }
          }
          return response()-&gt;json([
              'status' =&gt; true,
              'error' =&gt; 'Invalid data! Please upload a valid file.'
          ], 401); 
      }
  </code></pre>
  
  <p><strong>JS:</strong> </p>
  
  <pre><code>Dropzone.prototype.defaultOptions.dictDefaultMessage = "DRAG &amp; DROP FILES HERE TO UPLOAD";
  var myDropzone = new Dropzone("#fileupload", {
      acceptedFiles: ".jpg, .jpeg, .png, .zip",
      chunking: true,
      method: "POST",
      maxFilesize: 3072, // 3GB
      chunkSize: 10000000, // 10MB
      maxFiles: 6,
      parallelChunkUploads: true,
  });
  </code></pre>