API documentation :: Docs For Class arbitFrameworkMimeTypeGuesser
Packages:Interfaces:
Classes:
|
Core::arbitFrameworkMimeTypeGuesserClass arbitFrameworkMimeTypeGuesserThis class provides the basics for file mime type guessing and validation. This class provides the basics for file mime type guessing and validation. The mime types are basically guessed on the base of the file extension, which is rather inaccurate, because it is purely user provided value. For certain file types we offer callbacks, which may perform an additional validation step to ensure the file is of the guessed type, like for images, where we may use the PHP function getimagesize(), or to ensure proper contents in text files.
Member Variables
Method Summary
MethodscheckImageMimeType
static string
checkImageMimeType(
string
$file
, string
$mimeType
)
Check and validate guessed image mime type Tries to verify the guessed mime typ of image files using PHPs function getimagesize. detected the method will always fall back to 'application/octet-stream'. Check and validate guessed image mime type Tries to verify the guessed mime typ of image files using PHPs function getimagesize. If the mimetypes do not match, or active contents are detected the method will always fall back to 'application/octet-stream'. Parameters:
checkText
static string
checkText(
string
$file
, string
$mimeType
)
Check text contents. Check text contents. There are some non-printable characters we do not want in text files. If we detect them in a text file, we fall back to 'application/octet-stream'. Parameters:
guess
static string
guess(
string
$file
, [string
$userMimeType
= false] )
Guess mime type Guess the mime type of the given file, basically based on the file extension and optional additional validation mechanisms. mime type may be completely wrong, and just is a fair guess. really rely on user provided data. Guess mime type Guess the mime type of the given file, basically based on the file extension and optional additional validation mechanisms. The returned mime type may be completely wrong, and just is a fair guess. Do never really rely on user provided data. If the user also provided a mime type, it is checked if the user provided information is consitent with the guessed type. Otherwise we fall back to the default mimetype value: 'application/octet-stream'. Parameters:
Documentation generated on Mon, 05 Apr 2010 14:02:04 +0200 by phpDocumentor 1.4.3
|