本文整理汇总了PHP中FileUploader::fetchMedia方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUploader::fetchMedia方法的具体用法?PHP FileUploader::fetchMedia怎么用?PHP FileUploader::fetchMedia使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUploader
的用法示例。
在下文中一共展示了FileUploader::fetchMedia方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadMedia
/**
* Upload media file ,like: image/flash
*
* @author John.meng (цот╤РШ)
* @since version - 2006-1-7 12:56:23
* @param string
*
*/
function uploadMedia($CurrentUserPathImages, $oldPic = "", $PicType = "Pic", $newWidth = "", $newHeight = "", $CreateIco = false, $IcoWidth = "", $IcoHeight = "")
{
$allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'application/x-shockwave-flash');
$maxfilesize = 10000000;
$FileUploaderObj = new FileUploader($CurrentUserPathImages, $allowed_mimetypes, $maxfilesize);
$FileUploaderObj->newWidth = $newWidth;
$FileUploaderObj->newHeight = $newHeight;
if ($CreateIco && $IcoWidth && $IcoHeight) {
$FileUploaderObj->CreateIco = $CreateIco;
$FileUploaderObj->IcoWidth = $IcoWidth;
$FileUploaderObj->IcoHeight = $IcoHeight;
}
if ($_FILES[$PicType]['name'] != "") {
if ($FileUploaderObj->fetchMedia($PicType)) {
$FileUploaderObj->setPrefix($PicType . "_");
if (!$FileUploaderObj->upload()) {
echo $FileUploaderObj->getErrors();
} else {
$StrPic = $FileUploaderObj->getSavedFileName();
if ($oldPic) {
@unlink($CurrentUserPathImages . "/" . $oldPic);
}
}
}
} else {
$StrPic = $oldPic;
}
return $StrPic;
}