2016-07-27 2 views
0
//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 에서 변경 시도이 :치명적인 오류 : 정의되지 않은 함수 finfo_open()를 호출

;extension=php_fileinfo.dll

삭제; 앞에서 파일을 저장하고 닫습니다. 아파치 서버를 다시 시작하십시오.하지만 여전히 $ finfo = finfo_open (FILEINFO_MIME_TYPE) 라인에서 치명적인 오류가 발생합니다. 그리고 PHP 버전은 5.6.8입니다.

답변

관련 문제