<!--#include file="upfile.inc"-->
<script type="text/javascript">
function a(url) {
window.opener.document.form1.filedir.value=url;
}
function b(bw) {
window.opener.document.form1.fileext.value=bw;
}
function c(wjm) {
window.opener.document.form1.filename.value=wjm;
}
</script>
<%'上面的函数是把函数a(url)的参数值url赋给父页
response.charset = "GBK"
if request.querystring("menu") = "up" then
dim fileup,formpath,file,filename
set fileup=new Upload_file
fileup.GetDate(-1)
formpath="upload/ywk/"
set file=fileup.file("file")
if file.fileext <> "jpg" and file.fileext <> "doc" and file.fileext <> "xls" then
response.write "<script>alert('图片类型必须是jpg,doc,xls这三种');window.close();</script>"
response.end
end if
filename = formpath & year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now) & "." & file.fileext
wjm=file.filename
fileext=file.fileext
file.savetofile server.mappath(filename)
set file = nothing
set fileup = nothing
response.write "<script>a('"&filename&"');</script>"
response.write "<script>b('"&fileext&"');</script>"
response.write "<script>c('"&wjm&"');</script>"
response.write "<script>alert('文件添加成功');window.close();</script>"
else
%>
<form enctype="multipart/form-data" method="post" action=upfile_wj.asp?menu=up>
<input type="file" name="file" size="30">
<input type="submit" value="添加" />
</form>
<%
end if
%>