title: Why does Laravel's getMimeType() method identify a file as "application/octet-stream" when the file has the type attribute of "audio/mpeg"?
body: <p>I'm trying to upload a MP3 file to a Laravel application and have ran into an issue where even though the file has an attribute set to "audio/mpeg" it is uploaded as a "application/octet-stream" (.bin) file. When I try to die and dump the file on the server-side code with:</p>
  
  <pre><code>dd($request-&gt;file('file'));
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>UploadedFile {#187 ▼
    -test: false
    -originalName: "CUS12309821-20-AUG-2016-13-48-13.mp3"
    -mimeType: "audio/mpeg"
    -size: 47000471
    -error: 0
    path: "/private/var/folders/c7/6ws0lxy95dd_lhz1k067_zkc0000gn/T"
    filename: "phpyZCsbU"
    basename: "phpyZCsbU"
    pathname: "/private/var/folders/c7/6ws0lxy95dd_lhz1k067_zkc0000gn/T/phpyZCsbU"
    extension: ""
    realPath: "/private/var/folders/c7/6ws0lxy95dd_lhz1k067_zkc0000gn/T/phpyZCsbU"
    aTime: 2016-09-20 12:56:00
    mTime: 2016-09-20 12:56:00
    cTime: 2016-09-20 12:56:00
    inode: 4565593
    size: 47000471
    perms: 0100600
    owner: 501
    group: 20
    type: "file"
    writable: true
    readable: true
    executable: false
    file: true
    dir: false
    link: false
  }
  </code></pre>
  
  <p>Look at how when I use this method, it does indeed say that the file attribute for mimeType is the correct "audio/mpeg" format. However when I call the getMimeType() method on the file after it's uploaded, I get:</p>
  
  <pre><code>"application/octet-stream"
  </code></pre>
  
  <p>Here's the code in the routed method:</p>
  
  <pre><code>/**
   * Store a newly created resource in storage.
   *
   * @param  \Illuminate\Http\Request  $request
   * @return \Illuminate\Http\Response
   */
  public function store(Request $request)
  {
      $file = $request-&gt;all();
  
      $filePath = Storage::putFile('file', $request-&gt;file('files'));
  
      dd($request-&gt;file('file')-&gt;getMimeType());
  
      $file['path'] = Storage::url($filePath);
      $file['size'] = Storage::size($filePath);
      $file['type'] = $request-&gt;file('file')-&gt;getMimeType();
  
      return $file;
  }
  </code></pre>
  
  <p>This problem is seemingly unique in that I'm using the Laravel framework, where others with this problem are using vanilla PHP. Additionally, the excel file others may us may have reported itself as a application/octet-stream instead of an excel file. Finally, I believe this may be a issue with the guess() method, which is called by the getMethodType(). Someone with more Laravel experience could probably confirm this.</p>