【问题标题】:Fatal error: Call to undefined function finfo_open() [duplicate]致命错误:调用未定义函数 finfo_open() [重复]
【发布时间】:2016-12-01 17:33:01
【问题描述】:
//checks size of uploaded image on server side
if( $_FILES['userfile']['size'] < $maxsize) {

    //checks whether uploaded file is of image type
    //if(strpos(mime_content_type($_FILES['userfile']['tmp_name']),"image")===0) {
    $finfo=finfo_open(FILEINFO_MIME_TYPE);
    if(strpos(finfo_file($finfo, $_FILES['userfile']['tmp_name']),"image")===0) {

        // prepare the image for insertion
        $imgData =addslashes (file_get_contents($_FILES['userfile']['tmp_name']));

        // put the image in the db...
        // database connection
        mysql_connect($host, $user, $pass) OR DIE (mysql_error());

        // select the db
        mysql_select_db ($db) OR DIE ("Unable to select db".mysql_error());

我已经尝试更改在 php.ini 中搜索 php_fileinfo.dll 找到这个:

;extension=php_fileinfo.dll

删除;从前面,保存文件并关闭。重新启动 Apache 服务器。但我仍然在 $finfo = finfo_open(FILEINFO_MIME_TYPE); 行中收到致命错误如图所示,我的php版本是5.6.8。

【问题讨论】:

    标签: php


    【解决方案1】:

    嗯,您应该向发送魔术文件的 finfo_open 函数发送第二个参数。请阅读http://php.net/manual/es/function.finfo-open.php

    【讨论】:

      猜你喜欢
      • 2014-11-22
      • 1970-01-01
      • 2017-08-16
      • 1970-01-01
      • 2014-03-21
      • 2013-02-17
      • 2014-02-13
      • 2013-02-27
      • 1970-01-01
      相关资源
      最近更新 更多