note 102413 modified in function.finfo-file by danbrown

From: Date: Sun, 13 Feb 2011 14:33:01 +0000
Subject: note 102413 modified in function.finfo-file by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176949@lists.php.net to get a copy of this message
While figuring out my problem using this new function, i had a brainwave in using the full path of the file instead of the relative path. For example: <?php $folder = "somefolder/"; $fileName "aFile.pdf"; $finfo = finfo_open(FILEINFO_MIME_TYPE); finfo_file($finfo, $folder.$fileName); ?> This will result in an error where it can't find the file specified. This however fixxes that problem: <?php $folder = "somefolder/"; $fileName "aFile.pdf"; $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($finfo, dirname(__FILE__)."/".$folder.$fileName); ?> --was-- While figuring out my problem using this new function, i had a brainwave in using the full path of the file instead of the relative path. For example: $folder = "somefolder/"; $fileName "aFile.pdf"; $finfo = finfo_open(FILEINFO_MIME_TYPE); finfo_file($finfo, $folder.$fileName); This will result in an error where it can't find the file specified. This however fixxes that problem: $folder = "somefolder/"; $fileName "aFile.pdf"; $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($finfo, dirname(__FILE__)."/".$folder.$fileName); http://php.net/manual/en/function.finfo-file.php

« previous php.notes (#176949) next »