本文整理匯總了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;
}
}
}
}