本文整理汇总了PHP中Uploader::setCustomName方法的典型用法代码示例。如果您正苦于以下问题:PHP Uploader::setCustomName方法的具体用法?PHP Uploader::setCustomName怎么用?PHP Uploader::setCustomName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uploader
的用法示例。
在下文中一共展示了Uploader::setCustomName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$response->json($response);
} elseif ($route->match('iconimgupload', null)) {
// Prepare and sanitize post input
$api->setInputs($_POST);
$icon = $model->iconFind(array('id' => $api->getInputVal('id'), 'user_id' => $user->id));
if (!$icon) {
$response->status = 404;
$response->message = 'Not found';
$response->json($response);
}
$uploader = new Uploader();
$uploader->setDir('storage/icons/');
$uploader->setExtensions(array('png', 'jpg', 'gif'));
//allowed extensions list//
$uploader->setMaxSize(0.2);
$uploader->setCustomName($icon->name . '-' . $api->getInputVal('id') . '-' . time());
if (!$uploader->uploadFile('file')) {
$response->status = 500;
$response->message = $uploader->getMessage();
$response->json($response);
}
$model->iconUpdate(array('icon' => $uploader->getUploadName(), 'updated_at' => date("Y-m-d H:i:s")), array('id' => $icon->id));
$path = 'storage/icons/' . $api->getInputVal('current');
if (is_file($path)) {
unlink($path);
}
$response->data = array('icon' => $uploader->getUploadName());
$response->json($response);
} elseif ($route->match('userread', null)) {
// Prepare and sanitize post input
$response->data = $model->userFind(array('id' => $user->id));