本文整理汇总了PHP中qqFileUploader::upload方法的典型用法代码示例。如果您正苦于以下问题:PHP qqFileUploader::upload方法的具体用法?PHP qqFileUploader::upload怎么用?PHP qqFileUploader::upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qqFileUploader
的用法示例。
在下文中一共展示了qqFileUploader::upload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
$UserData->hide_online = 1;
} else {
$UserData->hide_online = 0;
}
if (isset($_POST['DeletePhoto'])) {
$UserData->removeFile();
}
if (isset($_FILES["UserPhoto"]) && is_uploaded_file($_FILES["UserPhoto"]["tmp_name"]) && $_FILES["UserPhoto"]["error"] == 0 && erLhcoreClassImageConverter::isPhoto('UserPhoto')) {
$UserData->removeFile();
$dir = 'var/userphoto/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $UserData->id . '/';
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit.photo_path', array('dir' => &$dir, 'storage_id' => $UserData->id));
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit.photo_store', array('file_post_variable' => 'UserPhoto', 'dir' => &$dir, 'storage_id' => $UserData->id));
// There was no callbacks
if ($response === false) {
erLhcoreClassFileUpload::mkdirRecursive($dir);
$file = qqFileUploader::upload($_FILES, 'UserPhoto', $dir);
} else {
$file = $response['data'];
}
if (!empty($file["errors"])) {
foreach ($file["errors"] as $err) {
$Errors[] = $err;
}
} else {
$UserData->removeFile();
$UserData->filename = $file["data"]["filename"];
$UserData->filepath = $file["data"]["dir"];
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit.photo_resize_150', array('mime_type' => $file["data"]['mime_type'], 'user' => $UserData));
if ($response === false) {
erLhcoreClassImageConverter::getInstance()->converter->transform('photow_150', $UserData->file_path_server, $UserData->file_path_server);
chmod($UserData->file_path_server, 0644);
示例2: validateUserPhoto
public static function validateUserPhoto(&$userData, $params = array())
{
$Errors = false;
if (isset($_FILES["UserPhoto"]) && is_uploaded_file($_FILES["UserPhoto"]["tmp_name"]) && $_FILES["UserPhoto"]["error"] == 0 && erLhcoreClassImageConverter::isPhoto('UserPhoto')) {
$Errors = array();
$dir = 'var/userphoto/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $userData->id . '/';
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit.photo_path', array('dir' => &$dir, 'storage_id' => $userData->id));
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit.photo_store', array('file_post_variable' => 'UserPhoto', 'dir' => &$dir, 'storage_id' => $userData->id));
// There was no callbacks
if ($response === false) {
erLhcoreClassFileUpload::mkdirRecursive($dir);
$file = qqFileUploader::upload($_FILES, 'UserPhoto', $dir);
} else {
$file = $response['data'];
}
if (!empty($file["errors"])) {
foreach ($file["errors"] as $err) {
$Errors[] = $err;
}
} else {
$userData->removeFile();
$userData->filename = $file["data"]["filename"];
$userData->filepath = $file["data"]["dir"];
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit.photo_resize_150', array('mime_type' => $file["data"]['mime_type'], 'user' => $userData));
if ($response === false) {
erLhcoreClassImageConverter::getInstance()->converter->transform('photow_150', $userData->file_path_server, $userData->file_path_server);
chmod($userData->file_path_server, 0644);
}
}
}
return $Errors;
}