本文整理汇总了PHP中UploadFile::setMaxSize方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadFile::setMaxSize方法的具体用法?PHP UploadFile::setMaxSize怎么用?PHP UploadFile::setMaxSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadFile
的用法示例。
在下文中一共展示了UploadFile::setMaxSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
$email = $db->stringEscape($_POST['email']);
string_validation($username, 8, 15);
//if password matches the retype, encrypt the user's password
if ($password == $password_again) {
//password encryption
$crypt_password = password_encrypt($password);
} else {
$error_flag++;
}
$temp = explode(".", $_FILES["avatar"]["name"]);
$extension = end($temp);
$destination .= "{$username}\\";
// try to create a new upload object
try {
$upload = new UploadFile($destination, "image");
$upload->setMaxSize($imageMaxSize);
$upload->upload(false);
$filename = $upload->getFilename();
$msgResult = $upload->getmessages();
} catch (Exception $e) {
$msgResult[] = $e->getMessage();
}
//upload user and avatar to db
if ($error_flag == 0) {
$query = "CALL add_user('" . $username . "', '" . $crypt_password . "' ,'" . $filename . "' , '" . $extension . "' , '" . $email . "' , '" . date('Y-m-d') . "' )";
if ($result = $db->query($query)) {
$_SESSION['user'] = $username;
echo "<script> location.href=\"account.php\" </script>";
if (isset($msgResult)) {
foreach ($msgResult as $msg) {
echo $msg . "*";