Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2> Advice </h2> <p>I really think you are getting things wrong here ...</p> <p>A. when a file is uploaded it also returns <code>mime type</code> automatically in the <code>$_FILES</code> </p> <pre><code>echo $_FILES['file']['type'][$i] ; </code></pre> <p>B if you want to get mime for a file that was not uploaded, or try and make a better determination that what the client headers provided, use <code>mime_content_type</code> <a href="http://php.net/manual/en/function.mime-content-type.php" rel="nofollow noreferrer">http://php.net/manual/en/function.mime-content-type.php</a></p> <pre><code>echo mime_content_type($fileName); </code></pre> <p>C. Depreciation </p> <p><s>Both <code>mime_content_type</code> &amp; <code>Fileinfo</code> are not properly maintained and they have been depreciated.</s></p> <p><strong>Update:</strong> It once was incorrectly marked as deprecated in the manual, but it has been fixed <a href="https://bugs.php.net/bug.php?id=71367" rel="nofollow noreferrer">https://bugs.php.net/bug.php?id=71367</a> on the 14th of January 2016. As can see supports 7.0 so not discontinued at all.</p> <p>Alternatively can suggest you look at the following links for replacement </p> <p><a href="https://stackoverflow.com/questions/10363199/getting-mime-type-of-zipped-files/10363354#10363354">Getting mime type of zipped files</a></p> <p><a href="http://www.php.net/manual/en/function.mime-content-type.php#87856" rel="nofollow noreferrer">http://www.php.net/manual/en/function.mime-content-type.php#87856</a></p> <p>D. You can also use <code>getID3</code> <a href="http://sourceforge.net/projects/getid3/files/getID3%28%29%201.x/1.9.3/" rel="nofollow noreferrer">http://sourceforge.net/projects/getid3/files/getID3%28%29%201.x/1.9.3/</a> which can check the real mime type for some common files ... </p> <p>E. Using Linux Command line probably saver </p> <pre><code>$mime = shell_exec("file -bi " . escapeshellarg($file)); </code></pre> <p>Or on Mac</p> <pre><code>$mime = shell_exec("file -b --mime ".escapeshellarg($file)); </code></pre> <h2> Finally </h2> <p>Why do you want to work on <code>$_FILES['file']['tmp_name'][$i]</code> directly ?? This has been know to give so many issues </p> <p>try</p> <pre><code>$tempDir = ""; // Temp foreach ( $_FILES ["file"] ["error"] as $key =&gt; $error ) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES ["file"] ["tmp_name"] [$key]; $name = $_FILES ["file"] ["name"] [$key]; $tempFile = "$tempDir/$name"; move_uploaded_file ( $tmp_name, $tempFile ); echo $user-&gt;get_mime ( $tempFile ); unlink ( $tempFile ); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload