Home >Backend Development >PHP Tutorial >PHP file upload .tmp file, finfo cannot read mime type

PHP file upload .tmp file, finfo cannot read mime type

WBOY
WBOYOriginal
2016-09-27 14:18:071367browse

As shown in the picture

PHP file upload .tmp file, finfo cannot read mime type

PHP file upload .tmp file, finfo cannot read mime type

I am also messy,
PS:

in the picture above
<code>finfo_file($finof,basename($this->filePath))</code>

This is what I tested before

<code>finfo_file($finof,$this->filePath)</code>

Just try to print it, the problem is not that

Reply content:

As shown in the picture

PHP file upload .tmp file, finfo cannot read mime type

PHP file upload .tmp file, finfo cannot read mime type

I am also messy,
PS:

in the picture above
<code>finfo_file($finof,basename($this->filePath))</code>

This is what I tested before

<code>finfo_file($finof,$this->filePath)</code>

Just try to print it, the problem is not that

finfo_fileYou need to pass in the path of the file, not the file name.

basename('C:WindowsTempphpA9C5.tmp') === 'phpA9C5.tmp'.

So, you should remove the basenamefunction

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn