日期:2014-05-16 浏览次数:21031 次
<!--#include file="upload_wj.inc"-->
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
formpath="up_pic/"
FileExt=trim(upload.form("FileExt"))
i=0
for each formName in upload.File
set file=upload.File(formName)
fileExt=lcase(file.FileExt) '得到的文件扩展名不含有.
if file.filesize<100 then
response.write "<script language=javascript>alert('请先选择你要上传的文件!');history.go(-1);</script>"
response.end
end if
if FileExt<>"swf" and FileExt<>"jpg" and fileext<>"gif" then
response.write "<script language=javascript>alert('该文件类型不能上传!');history.go(-1);</script>"
response.end
end if
if FileExt="swf" then
if fileext<>"swf" then
response.write "<script language=javascript>alert('只能上传swf格式的Flash文件!');history.go(-1);</script>"
response.end
end if
end if
if FileExt="jpg" then
if FileExt<>"gif" and fileext<>"jpg" then
response.write "<script language=javascript>alert('只能上传jpg或gif格式的图片!');history.go(-1);</script>"
response.end
end if
end if
if FileExt="swf" then
if file.filesize>(3000*1024) then
response.write "<script language=javascript>alert('Flash文件大小不能超过3m!');history.go(-1);</script>"
response.end
end if
end if
if FileExt="jpg" then
if file.filesize>(1000*1024) then
response.write "<script language=javascript>alert('图片文件大小不能超过1m!');history.go(-1);</script>"
response.end
end if
end if
randomize
ranNum=int(90000*rnd)+10000
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
session("bb")=filename%>
<form id="form1" name="form1" method="post" action="save.asp">
<table width="373" border="1">
<tr>
<td width="92">图片地址</td>
<td width="265">图片名称</td>
</tr>
<tr>
<td><input name="url" type="text" id="url" value="<% response.write FileName%>" /></td>
</tr>
</table>
<input type="submit" name="Submit" value="提交" />
</form>
<%
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
'file.SaveAs Server.mappath(filename) ''保存文件
file.SaveToFile Server.mappath(FileName)
session("aa")=FileName
if filelx="swf" then
response.write "<script>window.opener.document."&upload.form("FormName")&".size.value='"&int(file.FileSize/1024)&" K'</script&g