📄 upimg.php
字号:
<?php
require_once './../../../../inc/common.php';
require_once './../../../../inc/member.php';
$sizelimit="2000000";
function toframemsg($msg){
echo <<<vbvs
<script>
win = parent;
win.document.getElementById("upmsg").innerHTML="$msg";
</script>
vbvs;
exit();
}
function changeurl($thumburl, $url){
echo <<<vbvs
<script>
win = parent;
win.document.getElementById("txtUrl").value="$thumburl";
win.document.getElementById("txtLnkUrl").value="$url";
</script>
vbvs;
}
if ($groupid>1){
toframemsg("<font color=red>请先登陆</font>");
}else{
$filename=$_FILES['upfile'][name];
$allows=array('jpg', 'gif', 'png', 'bmp', 'psd');
$ext=trim(substr(strrchr($_FILES['upfile'][name], '.'), 1));
$ext=strtolower($ext);
$fname=date('j').'_'.mt_rand(100000,999999);
$dest='./../../../../upload/'.$fname;
$dest2='upload/'.$fname.'.'.$ext;
$thumb=$dest."_thumb";
$dest=$dest.'.'.$ext;
$thumb2='upload/'.$fname.'_thumb.'.$ext;
if($_FILES['upfile'][size]>$sizelimit||$_FILES['upfile']['error']==1){
toframemsg("<font color=red>错误:文件大小超过限制.</font>");
}
if (!in_array($ext, $allows)||substr($_FILES['upfile'][type], 0, 5)!= 'image'){
toframemsg("<font color=red>错误,不允许的文件格式!</font>");
}
move_uploaded_file($_FILES['upfile']['tmp_name'], $dest);
require_once './thumb.php';
$RESIZEWIDTH=500;
$RESIZEHEIGHT=500;
$WHEREWIDTH=500;
$WHEREHEIGHT=500;
$url=str_replace('images/editor/editor/dialog/fck_image.html', '', $_SERVER["HTTP_REFERER"]).$dest2;
$thumburl=str_replace('images/editor/editor/dialog/fck_image.html', '', $_SERVER["HTTP_REFERER"]).$thumb2;
MyThumb($dest,$RESIZEWIDTH,$RESIZEHEIGHT,$WHEREWIDTH,$WHEREHEIGHT,$thumb);
if (!file_exists("$thumb.$ext")){
$thumburl=$url;
}
changeurl($thumburl, $url);
toframemsg("文件上传成功");
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -