本文整理汇总了PHP中upload::isError方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::isError方法的具体用法?PHP upload::isError怎么用?PHP upload::isError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upload
的用法示例。
在下文中一共展示了upload::isError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: imageUpload
function imageUpload($argFILES, $argVarDirLocation, $varThumbnailWidth = '', $varThumbnailHeight = '', $varMediumWidth = '', $varMediumHeight = '')
{
$objUpload = new upload();
$objCore = new Core();
$objUpload->setMaxSize();
$objUpload->setDirectory($argVarDirLocation);
$varIsImage = $objUpload->IsImageValid($argFILES['type']);
if ($varIsImage) {
$varImageExists = 'yes';
} else {
$varImageExists = 'no';
}
if ($varImageExists == 'no') {
$objCore->setErrorMsg(IMAGE_TYPE_ERROR);
return false;
}
if ($varImageExists == 'yes') {
$objUpload->setTmpName($argFILES['tmp_name']);
if ($objUpload->userTmpName) {
$objUpload->setFileSize($argFILES['size']);
$objUpload->setFileType($argFILES['type']);
$varRandomNumber = $this->generateRandomKey();
$fileName = $varRandomNumber . '_' . strtolower($argFILES['name']);
$fileName = str_replace(' ', '_', $fileName);
$objUpload->setFileName($fileName);
$objUpload->startCopy();
if ($objUpload->isError()) {
$thumbnailName1 = '_thumb';
$objUpload->setThumbnailName($thumbnailName1);
$objUpload->createThumbnail();
if ($varThumbnailWidth == '' && $varThumbnailHeight == '') {
$objUpload->setThumbnailSize();
} else {
$objUpload->setThumbnailSize($varThumbnailWidth, $varThumbnailHeight);
}
$varFileName = $objUpload->userFileName;
$varExt = substr(strrchr($varFileName, "."), 1);
$varThumbFileNameNoExt = substr($varFileName, 0, -(strlen($varExt) + 1));
$varThumbFileName = $varThumbFileNameNoExt . 'thumb.' . $varExt;
$thumbnailName1 = '';
$objUpload->setThumbnailName($thumbnailName1);
$objUpload->createThumbnail();
if ($varMediumWidth == '' && $varMediumHeight == '') {
$objUpload->setThumbnailSize();
} else {
$objUpload->setThumbnailSize($varMediumWidth, $varMediumHeight);
}
return $varFileName;
} else {
$objCore->setErrorMsg(ERROR_ON_UPLOAD);
return false;
}
}
}
}