luya: Problem when upload file without PHP fileinfo ext.

Can not upload file without php fileinfo ext.

API send error:

{upload: false, message: "Error while storing your image in the storage component."}

Problem in FileHelper because when server haven’t fileinfo ext Yii will use extension of file name to detect mimeType

I use IIS server and my tmp upload file like: “C:\tmpdir\aaaa.tmp” => extension is “tmp” and “tmp” is not in list magic mineType of Yii => mineType empty => can’t validate in StorageContainer component => this issue.

See StorageContainer: #L384-L400

Additional infos

Q A
LUYA Version 1
PHP Version 7.0.9
Platform IIS 10
Operating system Windows 10

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (18 by maintainers)

Commits related to this issue

Most upvoted comments

@vuongminh See the commit above, this should fix the problem as well but its not recommend to ensure the mime type from a file name as it can contain ANYTHING… Rename hacker.exe to file.jpg and mime type will be jpg but should be exe - U know what i mean?

Windows users: just edit php.ini and uncomment this line:

extension=php_fileinfo.dll

Remember to restart Apache for new php.ini to take effect.

You mean in $_FILES? What would be the output from $_FILES in your case for the aaaaa.tmp file?