这个问题帮解决一下,马上给分!

andysern 2003-09-21 04:04:55
是上传文件的问题,要上传的文件类型为jpg,gif,rar,zip,txt,doc,wps,这几种,然后把数据存放在数据库中(如果存在服务器上,以文件的形式存放的话,请给出另外的代码,谢谢了)。涉及到文件的大小,尽量最大,然后超时的问题也好考虑一下。
尽量给出两个代码,给更高分(高到500---1000分啊,到时候来接分)
谢谢了
...全文
26 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
萝卜波 2003-09-22
  • 打赏
  • 举报
回复
有问题找我就是了
郁闷的时候
赚点分长角也是人生一大乐趣阿 呵呵
萝卜波 2003-09-22
  • 打赏
  • 举报
回复
if 文件较大的话 then

建议用组件上传 '速度快

end if

1) 所有的文件上传方法都一样啊

2)文件大小用 fso 来处理了
set file_system=createobject("scripting.filesystemobject")
set cur_folder=file_system.getfolder(c_path)
set sub_files=cur_folder.files

for each each_file in sub_files
file_size=each_file.size
next

3) 不用FSO 怎么创建文件呢
4)http://www.maqh.com.cn/pic/aspupload-src.zip
看看吧 很容易用的 and 好用

5)上传到服务器了
ljupin 2003-09-21
  • 打赏
  • 举报
回复
仔细看看就懂了,那里都有注释说明!
andysern 2003-09-21
  • 打赏
  • 举报
回复
几个问题,能不能给出分析结果,及主要的代码
1.文件名的分析(判断是何中文件,不同的文件是否用不同的上传方法,例如BMP与RAR的文件是否上传的方法一样)
2.文件大小的判断
3.关于FSO的使用,如果不能使用FSO如何实现
4.上传的主要代码和所使用的主要函数
5.如何存在服务器磁盘上
谢谢,高分,高分,要好多给好~混了~
tanguangzhang 2003-09-21
  • 打赏
  • 举报
回复
无组件是传:(主要由以下两个部分组成fsoconfig.asp,upprocess.asp;自己修改一下代码并再增加一个录入页面就可以了)
fsoconfig.asp




<%
sysname="圣章在线文件管理器"
sysurl="http://www.szcx.com"
sysversion="1.0.0000"
starttime=timer()
Server.ScriptTimeout=10000
ntime=server.urlencode(now())
selfname=request.servervariables("script_name")
userip=request.servervariables("remote_addr")
pagesize=40
totalpage=1
%>



upprocess.asp



<!--#include file="fsoconfig.asp"-->
<!--#include file="incupload.asp"-->
<%
set upload=new upload_5xsoft
if upload.form("act")="uploadfile" then
filepath=trim(upload.form("filepath"))
if left(filepath,1)<>"/" or instr(filepath,"\")>0 or instr(filepath,"*")>0 or instr(filepath,"?")>0 or instr(filepath,"'")>0 or instr(filepath,chr(34))>0 then
response.write "<center><div style='width:600px;margin-top:100px;padding:3px 0;text-align:center;font-size:12px;color:#990000;border:solid 1px;border-color:#000090 #000090 #cccccc;background:#cccccc'>圣章在线文件管理器--上传结果报告</div><div style='width:600px;padding:30px;font-size:12px;color:#000090;border:solid 1px;border-color:#000090 #000090 #cccccc;'>"
response.write "对不起,没有填写路径或路径中含有非法字符<br><br>"
response.write "<input type='button' style='width:65px;height:20px;font-size:12px' value='返回' onclick='window.history.go(-1)'>   <input type='button' style='width:65px;height:20px;font-size:12px' value='关闭' onclick='window.close()'></div>"&vbcrlf
response.write "<div style='width:600px;padding:3px 0;font-size:12px;color:#000090;border:solid 1px;border-color:#cccccc #000090 #000090;background:#cccccc;'>版权所有:<a href='http://www.szcx.com' target='_blank'>www.szcx.com</a>   程序设计:<a href=mailto:szcx@szcx.com>szcx@szcx.com</a></div>"&vbcrlf&"</center>"
response.end
end if
if right(filepath,1)<>"/" then
filepath=filepath&"/"
end if
if session("grade")<>3 and session("pathaccess")<>left(filepath,len(session("pathaccess"))) then
set upload=nothing
%>
<html>
<head>
<title><%=sysname%>--出错信息</title>
<META http-equiv=Content-Type content=text/html; charset=gb2312>
<script language="javascript">
<!--
function alert_msg()
{
alert("抱歉,你只有管理目录 “<%=session("pathaccess")%>” 及其子目录的权限!");
window.close();
}
//-->
</script>
</head>
<body onload="alert_msg()">
</body>
</html>
<%
response.end
end if
basepath=Server.mappath(filepath)
set obj_fso=server.createobject("scripting.filesystemobject")
if not obj_fso.folderexists(basepath) then
set obj_fso=nothing
set upload=nothing
response.write "<center><div style='width:600px;margin-top:100px;padding:3px 0;text-align:center;font-size:12px;color:#990000;border:solid 1px;border-color:#000090 #000090 #cccccc;background:#cccccc'>98062.com在线文件管理器--上传结果报告</div><div style='width:600px;padding:30px;font-size:12px;color:#000090;border:solid 1px;border-color:#000090 #000090 #cccccc;'>"
response.write "对不起,目录“"&filepath&"”不存在,请先创建该目录!<br>"&vbcrlf
response.write "<br><input type='button' style='width:65px;height:20px;font-size:12px' value='返回' onclick='window.history.go(-1)'>   <input type='button' style='width:65px;height:20px;font-size:12px' value='关闭' onclick='window.close()'></div>"
response.write "<div style='width:600px;padding:3px 0;font-size:12px;color:#000090;border:solid 1px;border-color:#cccccc #000090 #000090;background:#cccccc;'>版权所有:<a href='http://www.szcx.com' target='_blank'>www.szcx.com</a>   程序设计:<a href=mailto:szcx@szcx.com>szcx@szcx.com</a></div>"&vbcrlf&"</center>"
response.end
end if
%>
<html>
<head>
<title><%=sysname%>--上传文件成功</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body >
<center>
<div style="width:600px;margin-top:100px;padding:3px 0;text-align:center;font-size:12px;color:#990000;border:solid 1px;border-color:#000090 #000090 #cccccc;background:#cccccc">圣章在线文件管理器--上传结果报告</div>
<div style="width:600px;padding:30px;font-size:12px;color:#000090;border:solid 1px;border-color:#000090 #000090 #cccccc;">

<%
dim size
i=0
for each formName in upload.objFile
set file=upload.objFile(formName)
if file.FileSize>0 then
file.SaveAs basepath&"\"&file.FileName
response.write file.FileName&" ("&formatnumber(file.FileSize/1024,2,-1)&" K )  上传至  "
response.write filepath&file.FileName&"  成功!<br>"
i=i+1
end if
'将文件的大小传递给变量size
size=formatnumber(file.FileSize/1024,2,-1)
next
%>
<!--#include file="conn.asp"-->
<%
Rs.Source = "select * from software"
Rs.CursorType = 3 'adOpenKeyset
Rs.LockType = 3 'adLockOptimistic
Rs.Open
Rs.AddNew
rs("genusid")=upload.form("genusid")
rs("smallid")=upload.form("smallid")
rs("name")=upload.form("softname")
rs("introduce")=upload.form("softintroduce")
rs("system")=upload.form("system")
rs("language")=upload.form("language")
rs("grade")=upload.form("grade")
rs("homepage")=upload.form("homepage")
rs("email")=upload.form("email")
rs("address")=sysurl&filepath&file.FileName
rs("address1")=upload.form("address1")
rs("address2")=upload.form("address2")
rs("address3")=upload.form("address3")
rs("size")=size
rs("date")=now()
rs("grade")=upload.form("grade")
Rs.UpDate
set file=nothing
Rs.Close
Conn.Close

set upload=nothing
response.write "<br><br><br><b>共"&i&"个文件上传成功!</b><br>"
response.write "<br><input type='button' style='width:65px;height:20px;font-size:12px' value='返回' onclick='window.history.go(-1)'>   <input type='button' style='width:65px;height:20px;font-size:12px' value='关闭' onclick='window.close()'></div>"&vbcrlf
response.write "<div style='width:600px;padding:3px 0;font-size:12px;color:#000090;border:solid 1px;border-color:#cccccc #000090 #000090;background:#cccccc;'>版权所有:<a href='http://www.szcx.com' target='_blank'>www.szcx.com</a>   程序设计:<a href=mailto:szcx@szcxcom>szcx@szcx.com</a></div>"&vbcrlf&"</center>"&vbcrlf
response.write "</body>"&vbcrlf
response.write "</html>"&vbcrlf
else
set upload=nothing
response.redirect "fsoexplorer.asp?ntime="&ntime
end if
%>
ljupin 2003-09-21
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2257/2257516.xml?temp=.6588098

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧