【发布时间】: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