在线等 !!!!!!!!!!!
<input name="smallImg1" type="text" class="bj-border" id="smallImg1" size="30">
<input name="Submit23" type="button" class="input" onClick="window.open('upload_flash.asp?formname=myform&editname=smallImg1&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" value="上传图片">
上传成功就是路径没返回到smallImg1文本框!!1
upfile_flash.asp文件
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
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<10 then
response.write "<script language=javascript>alert('请先选择你要上传的文件!');history.go(-1);</script>"
response.end
end if
if (filelx<>"swf") and (filelx<>"jpg") then
response.write "<script language=javascript>alert('该文件类型不能上传!');history.go(-1);</script>"
response.end
end if
if filelx="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 filelx="jpg" then
if fileext<>"gif" and fileext<>"jpg" and fileext<>"swf" then
response.write "<script language=javascript>alert('只能上传jpg、gif或swf格式的图片!');history.go(-1);</script>"
response.end
end if
end if
if filelx="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 filelx="jpg" then
if file.filesize>(3000*1024) then
response.write "<script language=javascript>alert('图片文件大小不能超过3m!');history.go(-1);</script>"
response.end
end if
end if
randomize
ranNum=int(90000*rnd)+10000
wer=request.ServerVariables("HTTP_HOST")
filename="../news_images/"&wer&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
'filename="../"&picpath&"/"&tpname
%>
<%
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")&"."&upload.form("EditName")&".value='"&FileName&"'</script>"
%>
<%
end if
set file=nothing
next
set upload=nothing
end if
%>
<script language="javascript">
window.alert("文件上传成功!");
window.close();
</script>
文件upload_flash.asp
<%
filelx=request("filelx") '文件上传类型
formName=request("formName") '回传到上页面编辑框所在Form的Name
EditName=request("EditName") '回传到上页面编辑框的Name
picname=request("filename")
picpath=request("filepath")
%>
<html><head><title>图片上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="admin/images/css.css" rel="stylesheet" type="text/css">
<script language="javascript">
<!--
function mysub()
{
esave.style.visibility="visible";
}
-->
</script>
</head>
<body>
<form name="form1" method="post" action="upfile_flash.asp" enctype="multipart/form-data" >
<div id="esave" style="position:absolute; top:18px; left:40px; z-index:10; visibility:hidden">
<TABLE WIDTH=340 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR><td width=20%></td>
<TD bgcolor=#ff0000 width="60%">
<TABLE WIDTH=100% height=120 BORDER=0 CELLSPACING=1 CELLPADDING=0>
<TR>
<td bgcolor=#ffffff align=center><font color=red>正在上传文件,请稍候...</font></td>
</tr>
</table>
</td><td width=20%></td>
</tr></table></div>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" background="../../images/bg2.jpg" bgcolor="#FFFFFF" class="tableBorder">
<tr>
<td align="center" background="admin/images/admin_bg_1.gif"><b><font color="#ffffff">图片上传
<input type="hidden" name="filepath" value="">
<input type="hidden" name="filelx" value="<%=filelx%>">
<input type="hidden" name="EditName" value="<%=EditName%>">
<input type="hidden" name="FormName" value="<%=formName%>">
<input type="hidden" name="act" value="uploadfile"></font></b>
</td>
</tr>
<tr bgcolor="#E8F1FF">
<td height="80" align="center" background="../../images/bar.gif" id="upid">选择文件:
<input type="file" name="file1" size="40" class="tx1" value="">
<input type="submit" name="Submit" value="开始上传" class="button" onclick="javascript:mysub()"></td>
</tr>
</table>
</form>
</body>
</html>