📄 up_bookpicpro.asp
字号:
<!--#include file="upload.inc"-->
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
filepath=trim(upload.form("filepath"))
filelx=trim(upload.form("filelx"))
i=0
for each formName in upload.File
set file=upload.File(formName)
fileExt=lcase(file.FileExt) '得到的文件扩展名不含有.
if file.filesize<1 then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">请先选择你要上传的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
if (filelx<>"swf") and (filelx<>"jpg") then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">该文件类型不能上传! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
if filelx="swf" then
if fileext<>"swf" then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传swf格式的Flash文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
end if
if filelx="jpg" then
if fileext<>"gif" and fileext<>"jpg" then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg或gif格式的图片! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
end if
if filelx="swf" then
if file.filesize>(3000*1024) then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 3M 的Flash文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
end if
if filelx="jpg" then
if file.filesize>(1000*1024) then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 1000K 的图片文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
end if
randomize
ranNum=int(90000*rnd)+10000
filename=filepath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
%>
<%
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
'file.SaveAs Server.mappath(filename) ''保存文件
file.SaveToFile Server.mappath(FileName)
'response.write file.FileName&" 上传成功! <br>"
'response.write "新文件名:"&FileName&"<br>"
'response.write "新文件名已复制到所需的位置,可关闭窗口!"
if filelx="swf" then
response.write "<script>window.opener.document."&upload.form("FormName")&".size.value='"&int(file.FileSize/1024)&" K'</script>"
end if
response.write "<script>window.opener.document."&upload.form("FormName")&".Pic.value='"&replace(FileName,"../","")&"'</script>"
dim saveimg
saveimg=FileName'获取保存路径
Dim Jpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg") '创建实例
Path = Server.MapPath(saveimg) '处理图片路径
Jpeg.Open Path '打开图片
'调整宽度和高度为原来的50%
aaaaa=Jpeg.OriginalWidth/Jpeg.OriginalHeight
Jpeg.Width = 135
Jpeg.Height =int(135/aaaaa)
Jpeg.Save Server.MapPath(saveimg) '保存图片到磁盘
Jpeg.Close:Set Jpeg = Nothing
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath(saveimg) '打开保存图片的路径
' 添加文字水印
Jpeg.Canvas.Font.Color = &H000000' 红色
Jpeg.Canvas.Font.Family = "Arial"
Jpeg.Canvas.Font.Bold = False
Jpeg.Canvas.Pen.Width = 1' 画笔宽度
jpeg.canvas.font.size= 12 ' 字号
Jpeg.Canvas.Brush.Solid = False '是否加粗处理
Jpeg.Canvas.Print Jpeg.OriginalWidth-110,Jpeg.OriginalHeight-15, "M i a n T u o X i e . c o m" '水印离左边的距离,离顶端的距离,这个是放在右下脚了
'保存文件
Jpeg.Save Server.MapPath(saveimg) '保存添加水印后的图片
' 注销对象
Set Jpeg = Nothing
%>
<%
end if
set file=nothing
next
set upload=nothing
end if
%>
<script language="javascript">
window.alert("文件上传成功!请不要修改生成的链接地址!");
window.close();
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -