0

I am getting error like this

Fatal error: Using $this when not in object context in C:\xampp\htdocs\public_html\cjls\check.php on line 243

hen i try to get mime type of file, how may i fix this if any idea

<?php
    $folderinfo = "filepath/filename.php";
    $folderinfo     = pathinfo($folderinfo);
    $basename = $folderinfo['basename'];
    $ext      = $folderinfo['extension'];
    $mimeTypes = array(
            "323"       => "text/h323",
            "zip"       => "application/zip"
    );

    $mime = isset($this->mime_types[$ext]) ? $this->mime_types[$ext] : "application/octet-stream";

    echo $mime;
    ?>
Alex
  • 87
  • 8
  • Looks like you copied and pasted this from somewhere else as you are clearly not using a class but are using `$this`. – John Conde Jul 21 '16 at 12:25
  • where is the object `$mime_types` defined / instantiated? I think you want this: `isset($mimeTypes[$ext]) ? $mimeTypes[$ext] : 'application/octet-stream'` – mister martin Jul 21 '16 at 12:27

0 Answers0