//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 找到这个:
;延长= php_fileinfo.dll
删除;从前面,保存文件并关闭。重新启动Apache server.But仍然在$ finfo = finfo_open(FILEINFO_MIME_TYPE)行中收到致命错误;我的php版本是5.6.8,如图所示。
答案 0 :(得分:0)
嗯,你应该向发送魔术文件的finfo_open函数发送第二个参数。请阅读http://php.net/manual/es/function.finfo-open.php