0

When i am uploading this on my server then it shows me error:

Call to undefined function finfo_open()

, But on localhost it works.

$img_file= $row['CERT_IMAGE'];
$type1="../img/certImg/".$img_file;
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$type = getMIMEType($type1);
echo $type;

function getMIMEType($type1){
 $finfo = finfo_open();
 $fileinfo = finfo_file($finfo, $type1, FILEINFO_MIME_TYPE);
 finfo_close($finfo);
 return $fileinfo;
}  

<td width="5%" align="center"><strong>:</strong></td>
<?php
  if($type == "application/pdf")
   {
 ?>
<td width="55%" align="left"><iframe src="../img/certImg/<?php echo 
 $img_file;?>" style="width:200px; height:300px;" frameborder="0"></iframe> 
 <br>
 <a class="btn btn-primary" id="btnSubmit" target="_blank" 
 href="../img/certImg/<?php echo $img_file;?>" style="font-size:20px; ">View 
 Pdf</a>
 </td> 
<?php 
} else {
?>
<td width="55%" align="left"><img src="../img/certImg/<?php echo $img_file; 
?>" id="myImg" width="200px" height="300px"></td>
<?php } ?>
</tr>
Mohammad Kanan
  • 4,452
  • 10
  • 23
  • 47

1 Answers1

0

Make sure that you have the fileinfo.so or php_fileinfo.dll is enabled in the php.ini

extension=fileinfo.so or extension=php_fileinfo.dll
Rp9
  • 1,955
  • 2
  • 23
  • 31