title: Laravel 8 file upload validation fails with any rule
body: <p>I want to validate a file upload but with literally any validation rule, I get &quot;The (name of input) failed to upload.&quot; I've seen this issue in a few places but none of the solutions worked for me.</p>
  <p>I'm using Laravel 8.0, php 8.0.2, and nginx/1.18.0 on ubuntu.</p>
  <p>Controller:</p>
  <pre><code>public function uploadMedia (Request $request)
  {
      $request-&gt;validate([
          'file' =&gt; 'required',
          'alt' =&gt; 'required',
      ]);
      dd('valid');
  }
  </code></pre>
  <p>Blade file:</p>
  <pre><code>@if($errors-&gt;any())
      @foreach ($errors-&gt;all() as $error)
          &lt;p class=&quot;alert error&quot;&gt;{{ $error }}&lt;/p&gt;
      @endforeach
  @endif
  
  &lt;form method=&quot;POST&quot; action=&quot;/media&quot; enctype=&quot;multipart/form-data&quot;&gt;
      @csrf
      &lt;input type=&quot;file&quot; name=&quot;file&quot; /&gt;
      &lt;input type=&quot;text&quot; name=&quot;alt&quot; placeholder=&quot;Write a short description of the image under 160 characters.&quot; /&gt;
      &lt;button type=&quot;submit&quot;&gt;Upload&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>If I get rid of the validation rule for 'file' it works, I get to the dd.</p>
  <pre><code>$request-&gt;validate([
      'file' =&gt; '', // works if I do this
      'alt' =&gt; 'required',
  ]);
  </code></pre>
  <p>I've seen other people have this issue and I've tried:</p>
  <ul>
  <li>Putting another rule (max:10000, image) instead of 'required'
  for the file – still get the same error.</li>
  <li>Changing the values php.ini to <code>post_max_size = 201M</code> and
  <code>upload_max_filesize = 200M</code> (this shouldn't be an issue in the
  first place because the image I am trying to upload is a 136kb jpg). Verified with <code>phpinfo();</code></li>
  <li>After changing these values, reloading nginx and php-fpm</li>
  <li>Rebooting the VM</li>
  <li>Checking that all the double and single quotes are the correct character</li>
  <li>Trying to upload other filetypes like png or txt, same error.</li>
  <li>Putting 'image' as the first validation rule which worked for someone <a href="https://stackoverflow.com/questions/30831599/laravel-5-image-validation-doesnt-work">here</a></li>
  <li>Removing the extra comma at the end of the rules array</li>
  <li>Changing the name of the file input to something other than 'file'</li>
  <li>Using a different browser (Firefox and Chrome)</li>
  <li>Disabling all my browser extensions</li>
  <li>Writing the validation like this instead (still get the same error):</li>
  </ul>
  <pre><code>$validator = Validator::make($request-&gt;all(), [
      'file' =&gt; 'required',
      'alt' =&gt; 'required'
  ]); 
  if ($validator-&gt;fails()) {
      return redirect('/media')-&gt;withErrors($validator);
  }
  </code></pre>
  <p>If I dd($request) before validating:</p>
  <pre><code>Illuminate\Http\Request {#44 ▼
    #json: null
    #convertedFiles: null
    #userResolver: Closure($guard = null) {#255 ▶}
    #routeResolver: Closure() {#264 ▶}
    +attributes: Symfony\Component\HttpFoundation\ParameterBag {#46 ▶}
    +request: Symfony\Component\HttpFoundation\ParameterBag {#45 ▼
      #parameters: array:2 [▼
        &quot;_token&quot; =&gt; &quot;RrjAA2YvnSd3EYqg8vAwoWT4y6VenJzGjb5S72SU&quot;
        &quot;alt&quot; =&gt; &quot;dsfghdf&quot;
      ]
    }
    +query: Symfony\Component\HttpFoundation\InputBag {#52 ▶}
    +server: Symfony\Component\HttpFoundation\ServerBag {#49 ▶}
    +files: Symfony\Component\HttpFoundation\FileBag {#48 ▼
      #parameters: array:1 [▼
        &quot;file&quot; =&gt; Symfony\Component\HttpFoundation\File\UploadedFile {#33 ▼
          -test: false
          -originalName: &quot;Screen Shot 2021-03-08 at 9.33.19 AM.png&quot;
          -mimeType: &quot;application/octet-stream&quot;
          -error: 6
          path: &quot;&quot;
          filename: &quot;&quot;
          basename: &quot;&quot;
          pathname: &quot;&quot;
          extension: &quot;&quot;
          realPath: &quot;/var/www/[my domain]/public&quot;
          aTime: 1970-01-01 00:00:00
          mTime: 1970-01-01 00:00:00
          cTime: 1970-01-01 00:00:00
          inode: false
          size: false
          perms: 00
          owner: false
          group: false
          type: false
          writable: false
          readable: false
          executable: false
          file: false
          dir: false
          link: false
        }
      ]
    }
    +cookies: Symfony\Component\HttpFoundation\InputBag {#47 ▶}
    +headers: Symfony\Component\HttpFoundation\HeaderBag {#50 ▶}
    #content: null
    #languages: null
    #charsets: null
    #encodings: null
    #acceptableContentTypes: null
    #pathInfo: &quot;/media&quot;
    #requestUri: &quot;/media&quot;
    #baseUrl: &quot;&quot;
    #basePath: null
    #method: &quot;POST&quot;
    #format: null
    #session: Illuminate\Session\Store {#296 ▶}
    #locale: null
    #defaultLocale: &quot;en&quot;
    -preferredFormat: null
    -isHostValid: true
    -isForwardedValid: true
    -isSafeContentPreferred: null
    basePath: &quot;&quot;
    format: &quot;html&quot;
  }
  </code></pre>