我自己做了一个论文上传系统,(使用的是化境无组件上传2.0)以前在WIN2003 IIS6服务器上使用的好好的,但最近换成WIN2008 IIS7服务器后就不正常了。点击提交上传后,页面就变成空白的了,论文也没有上传到服务里。IIS ASP父目录是勾了的。
上传系统共6个程序文件,一个TXT文本
index.asp ‘教师填写姓名、教研组、年级部信息,选择好论文文件,上传。
upload.asp '对index.asp填写的信息进行判断,符合要求就上传并在a.txt文件记录上传人数编号,并将上传的文件按:编号-姓名-年级部-教研组-学科-论文名称 重命名论文。
list.asp ‘显示已上传的到服务器的论文
upload_5xsoft.inc '化境无组件上传2.0
因为index.asp运行是正常的,是提交到upload.asp执行时显示空白,所以将这个文件的源代码贴出。希望专家您能帮助我解决问题,谢谢。
另:我的上传系统网址:http://lunwen.mynssy.com
upload.asp
上传系统共6个程序文件,一个TXT文本
index.asp ‘教师填写姓名、教研组、年级部信息,选择好论文文件,上传。
upload.asp '对index.asp填写的信息进行判断,符合要求就上传并在a.txt文件记录上传人数编号,并将上传的文件按:编号-姓名-年级部-教研组-学科-论文名称 重命名论文。
list.asp ‘显示已上传的到服务器的论文
upload_5xsoft.inc '化境无组件上传2.0
因为index.asp运行是正常的,是提交到upload.asp执行时显示空白,所以将这个文件的源代码贴出。希望专家您能帮助我解决问题,谢谢。
另:我的上传系统网址:http://lunwen.mynssy.com
upload.asp
<%OPTION EXPLICIT%>
<%Server.ScriptTimeOut=5000%>
<html>
<head>
<title>文件上传</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<meta http-equiv="Content-Language" Content="zh-CN">
<style type="text/css">
body {font-size:9pt;}
input {font-size:9pt;}
.STYLE1 {
font-size: 16pt;
font-weight: bold;
color: #FF0000;
}
.STYLE2 {color: #FF0000;
font-size: 14px
}
.STYLE3 {font-size: 14px}
</style>
</head>
<body leftmargin="10" topmargin="10" bgcolor="#FFFFFF">
<!-- #include file="upload_5xsoft.inc" -->
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from [unit] where name='"&Session("name")&"'",conn,1,1
%>
342423424
<%
dim upload,file,formName,iCount,FolderNameNew,name1,title,xuebu,jiaoyanzu
dim GuFolderPath,fso,GuFolder0,GuFileSize0,GuFileExt0,GuAutoName
set upload=new upload_5xsoft '建立上传对象
GuFolder0="updata/" '设定默认上传的目录,必须以“/”结束,可以为空
GuFileSize0=5120 '设定默认允许上传的最大文件,单位:K,1024K=1M
GuFileExt0="doc|wps|docx" '设定默认允许上传的文件类型
GuAutoName="2" '设定上传成功后的文件名自动重新命名或是使用原来的名称,1为以当前日期,2为以作者姓名+标题,0为否
name1=rs("姓名")
xuebu=rs("学部")
jiaoyanzu=rs("教研组")
title=upload.form("标题")
Response.write "<table width =650 height=300 align=center><tr><td align=center><Font face=黑体 size=5>"&upload.Version&"</font></td></tr><tr><td>" '显示上传类的版本
if upload.form("GuFolderPath")<>"" then
GuFolderPath=upload.form("GuFolderPath")
call FolderNameCheck(GuFolderPath)
GuFolderPath=upload.form("GuFolderPath")
if right(GuFolderPath,1)<>"/" then GuFolderPath=GuFolderPath&"/"
elseif upload.form("GuFolderPath")="" and GuFolder0<>"" then
GuFolderPath=GuFolder0
call FolderNameCheck(GuFolderPath)
GuFolderPath=GuFolder0
if right(GuFolderPath,1)<>"/" then GuFolderPath=GuFolderPath&"/"
else
GuFolderPath=""
end if
dim mfo,rtf,body
set mfo=Server.CreateObject("Scripting.FileSystemObject")
set rtf=mfo.OpenTextFile(server.mappath("a.txt"),1)
body=rtf.readall
rtf.close
set rtf=nothing
set mfo=nothing
iCount=body+1
Response.write "<br><br><br>"&"<font face=黑体 color=blue>姓名:</font>"&name1&"<br>"&"<font face=黑体 color=blue>学部:</font>"&xuebu&"<br>"&"<font face=黑体 color=blue>教研组:</font>"&jiaoyanzu&"<br>"&"<font face=黑体 color=blue>文章标题:</font>"&title&"<br>"
Response.write "<br><br>"
for each formName in upload.objFile '列出所有上传了的文件
set file=upload.file(formName)
if file.FileSize>0 then
dim FileExtF,FileExtY,FileExtOK,ii,jj
FileExtF=split(File.FileName,".")
for jj=0 to ubound(FileExtF)
next
FileExtY=0
FileExtOK=split(GuFileExt0,"|")
for ii=0 to ubound(FileExtOK)
if FileExtOK(ii)=FileExtF(jj-1) then
FileExtY=1
exit for
end if
next
if FileExtY=0 then
Htmend "上传失败,不允许上传的文件类型。注意:文件名不得带引号、点号等非法符号"
elseif file.FileSize>GuFileSize0*1024 then
Htmend "上传失败,单个文件大小超过限制,最大"&GuFileSize0&"*1024 字节,1K=1024字节"
else
dim FileNameOK,a
if GuAutoName="1" then
FileNameOK=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&iCount&"."&FileExtF(jj-1)
elseif GuAutoName="2" then
FileNameOK=iCount&"-"&name1&"-"&xuebu&"-"&jiaoyanzu&"-"&title&"."&FileExtF(jj-1)
else
FileNameOK=file.FileName
end if
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.fileexists(server.mappath("updata/"&iCount-1&name1&"-"&title&"."&FileExtF(jj-1))) then
Set fso = nothing
a=5
response.write "<script>alert('你已经上传成功,请不要重复提交!');location='list.asp';</script>"
end if
if a<>5 then
file.SaveAs Server.mappath(GuFolderPath&FileNameOK) '保存文件
Response.write "<font face=黑体 color=blue>原文件名:</font>"&file.FilePath&file.FileName&" (大小:"&file.FileSize&" 字节) <br><font face=黑体 color=blue> 现文件名:</font>"&FileNameOK&"<br>"
set mfo=Server.CreateObject("Scripting.FileSystemObject")
set rtf=mfo.OpenTextFile(server.mappath("a.txt"),2)
rtf.write (iCount)
rtf.close
set rtf=nothing
set mfo=nothing
end if
end if
else
Htmend "上传失败,请选择要上传的文件"
end if
set file=nothing
next
set upload=nothing
Htmend "</td></tr><tr><td align=center><font face=黑体 color=red size=5>你的文件上传成功,请不要再重复上传!</font></td></tr><tr><td align=center>"
Sub FolderNameCheck(FolderNameNew)
dim Letters,i,c
Letters="+=:;,[]<>\|*?"
for i=1 to len(FolderNameNew)
c=mid(FolderNameNew,i,1)
if inStr(Letters,c)<>0 then
Htmend "上传失败,文件夹名称含有特殊字符"
end if
next
GuFolderPath=server.MapPath(GuFolderPath)
Set fso=Server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(GuFolderPath)=false then
fso.CreateFolder(GuFolderPath)
end if
Set fso=nothing
End sub
Sub HtmEnd(Msg)
set upload=nothing
response.write "<br>"&Msg&" <br><br><input type=""button"" class=""STYLE1"" value="" 查看已提交论文名单 "" οnclick=""javascript:top.location='list.asp';""></td></tr></table></body></html>"
response.end
End sub
%>
</body>
</html>