本文整理汇总了PHP中uploader::rename_file方法的典型用法代码示例。如果您正苦于以下问题:PHP uploader::rename_file方法的具体用法?PHP uploader::rename_file怎么用?PHP uploader::rename_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uploader
的用法示例。
在下文中一共展示了uploader::rename_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: errorLogin
errorLogin($lang->phrase('not_allowed'), "editprofile.php");
} elseif (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
require "classes/class.upload.php";
$my_uploader = new uploader();
$my_uploader->max_filesize($config['avfilesize']);
$my_uploader->max_image_size($config['avwidth'], $config['avheight']);
if ($my_uploader->upload('upload', explode('|', $config['avfiletypes']))) {
$my_uploader->save_file('uploads/pics/', '2');
}
if ($my_uploader->return_error()) {
error($my_uploader->return_error(), 'editprofile.php?action=pic');
} else {
if (file_exists($my->pic)) {
@unlink($my->pic);
}
$ext = $my_uploader->rename_file('uploads/pics/', $my_uploader->file['name'], $my->id);
}
$my->pic = 'uploads/pics/' . $my->id . $ext;
} elseif (!empty($pic) && preg_match('/^(http:\\/\\/|www.)([\\wהצ�ִײ�@\\-_\\.]+)\\:?([0-9]*)\\/(.*)$/', $pic, $url_ary)) {
$my->pic = checkRemotePic($pic, $url_ary, $my->id);
} else {
removeOldImages('uploads/pics/', $my->id);
}
$db->query("UPDATE {$db->pre}user SET pic = '{$my->pic}' WHERE id = '{$my->id}' LIMIT 1", __LINE__, __FILE__);
ok($lang->phrase('editprofile_pic_success'), "editprofile.php?action=pic" . SID2URL_x);
} elseif ($_GET['action'] == "pic") {
if ($my->p['usepic'] == 0) {
errorLogin($lang->phrase('not_allowed'), "editprofile.php");
}
$breadcrumb->Add($lang->phrase('editprofile_pic'));
echo $tpl->parse("header");
示例2: eval
($code = $plugins->load('editprofile_pic3_end')) ? eval($code) : null;
ok($lang->phrase('editprofile_pic_success'), "editprofile.php?action=pic" . SID2URL_x);
} elseif ($_GET['action'] == "pic2") {
$pic = $gpc->get('pic', none);
if ($my->p['usepic'] == 0) {
errorLogin($lang->phrase('not_allowed'), "editprofile.php");
}
$error = array();
if (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
require "classes/class.upload.php";
$my_uploader = new uploader();
$my_uploader->max_filesize($config['avfilesize']);
$my_uploader->max_image_size($config['avwidth'], $config['avheight']);
$my_uploader->file_types(explode(',', $config['avfiletypes']));
$my_uploader->set_path('uploads/pics/');
$my_uploader->rename_file($my->id);
if ($my_uploader->upload('upload')) {
removeOldImages('uploads/pics/', $my->id);
if ($my_uploader->save_file()) {
$my->pic = 'uploads/pics/' . $my_uploader->fileinfo('filename');
}
}
if ($my_uploader->upload_failed()) {
$error[] = $my_uploader->get_error();
}
} elseif (!empty($pic) && preg_match(URL_REGEXP, $pic)) {
$my->pic = checkRemotePic($pic, $my->id);
switch ($my->pic) {
case REMOTE_INVALID_URL:
$error[] = $lang->phrase('editprofile_pic_error1');
$my->pic = '';