4个回答
展开全部
<%Server.ScriptTimeOut=5000%>
<!--#include file="conn.asp"-->
<!--#include file="upload_5xsoft.inc"-->
<html>
<head>
<title>文件上传</title>
<link rel="stylesheet" href="images/style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
dim upload,file,formName,formPath,iCount,exeec,wjm,lm
set upload=new upload_5xsoft
formPath="pictures/"
wjm=upload.form("file")
wjdx=0
for each formName in upload.objFile
if upload.form("zclj")="" then
set file=upload.file(formName)
wjdx = file.filesize
kzm = right(file.filename,4)
else
kzm = right(wjm,4)
end if
if lcase(kzm)<>".gif" and lcase(kzm)<>".bmp" and lcase(kzm)<>".jpg" then response.Redirect("add_pic.asp")
if upload.form("zclj")<>"" or wjdx<819200 then
set rs=server.CreateObject("adodb.recordset")
name=formPath + replace(cstr(date()),"-","") + replace(cstr(time()),":","") + kzm
'定义记录集,把用户输入的数据插入到数据表中
sql="select * from message"
rs.open sql,conn,1,3
rs.addnew
rs("add_date")=right(cstr(date()),len(cstr(date()))-2)
rs("add_time")=time
if upload.form("zclj")="" then
rs("zp")=name
dx=cstr(file.filesize/1024)
if len(dx) >6 then dx=left(dx,6)
rs("wjdx") = dx +"K"
else
rs("zp")=wjm
rs("wjdx") = "0K"
end if
small_class_id=upload.form("small_class_id")
rs("small_class_id")=small_class_id
rs("big_class_id")=small_class_id
zt=upload.form("zt")
rs("zt")=zt
title=upload.form("title")
rs("title")=title
if wjdx>0 and wjdx<819200 and upload.form("zclj")="" then
file.SaveAs Server.mappath(name)
end if
iCount=iCount+1
rs.update
rs.close
cg="1"
end if
set file=nothing
next
set upload=nothing '删除此对象
sub HtmEnd(Msg)
set upload=nothing
response.end
end sub
if cg="1" then response.redirect "add_pic.asp"
%>
不能上传大于800K的文件(0.8M)!
</body>
</html>
=========
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="images/style.css" -->
<body>
<form name="dd" method="post" action="scfile.asp" enctype="multipart/form-data" >
<input type="hidden" name="act" value="upload">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td>图片主题:<input name="zt" type="text" class="inputtext" size="30" maxlength="100"></td></tr>
<tr><td>标题:<input name="title" type="text" class="inputtext" id="title" size="65"></td></tr>
<tr>
<td colspan="2" align="left" id="upid2">
<label>
<select name="small_class_id" id="small_class_id">
<option value="52">第1-8类商品</option>
<option value="44">第9-14类商品 </option>
<option value="79">第15-19类商品</option>
<option value="124">第20-22类商品</option>
</select>
</label> </td>
</tr>
<tr height="25">
<td colspan="2" align="left" id="upid"><input type="file" name="file1"></td>
</tr>
<tr height="25">
<td colspan="2" align="left" id="upid"> </td>
</tr>
<tr height="25">
<td colspan="2" align="center">
<input type="submit" value=" 发 送 " name="cmdOk" class="inputbox" style="font-family: 宋体; font-size: 9pt;">
<input type="reset" name="Submit2" value=" 重 设 " class="inputbox" style="font-family: 宋体; font-size: 9pt;"> </td>
</tr>
</table>
</form>
</body>
</html>
<!--#include file="conn.asp"-->
<!--#include file="upload_5xsoft.inc"-->
<html>
<head>
<title>文件上传</title>
<link rel="stylesheet" href="images/style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
dim upload,file,formName,formPath,iCount,exeec,wjm,lm
set upload=new upload_5xsoft
formPath="pictures/"
wjm=upload.form("file")
wjdx=0
for each formName in upload.objFile
if upload.form("zclj")="" then
set file=upload.file(formName)
wjdx = file.filesize
kzm = right(file.filename,4)
else
kzm = right(wjm,4)
end if
if lcase(kzm)<>".gif" and lcase(kzm)<>".bmp" and lcase(kzm)<>".jpg" then response.Redirect("add_pic.asp")
if upload.form("zclj")<>"" or wjdx<819200 then
set rs=server.CreateObject("adodb.recordset")
name=formPath + replace(cstr(date()),"-","") + replace(cstr(time()),":","") + kzm
'定义记录集,把用户输入的数据插入到数据表中
sql="select * from message"
rs.open sql,conn,1,3
rs.addnew
rs("add_date")=right(cstr(date()),len(cstr(date()))-2)
rs("add_time")=time
if upload.form("zclj")="" then
rs("zp")=name
dx=cstr(file.filesize/1024)
if len(dx) >6 then dx=left(dx,6)
rs("wjdx") = dx +"K"
else
rs("zp")=wjm
rs("wjdx") = "0K"
end if
small_class_id=upload.form("small_class_id")
rs("small_class_id")=small_class_id
rs("big_class_id")=small_class_id
zt=upload.form("zt")
rs("zt")=zt
title=upload.form("title")
rs("title")=title
if wjdx>0 and wjdx<819200 and upload.form("zclj")="" then
file.SaveAs Server.mappath(name)
end if
iCount=iCount+1
rs.update
rs.close
cg="1"
end if
set file=nothing
next
set upload=nothing '删除此对象
sub HtmEnd(Msg)
set upload=nothing
response.end
end sub
if cg="1" then response.redirect "add_pic.asp"
%>
不能上传大于800K的文件(0.8M)!
</body>
</html>
=========
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="images/style.css" -->
<body>
<form name="dd" method="post" action="scfile.asp" enctype="multipart/form-data" >
<input type="hidden" name="act" value="upload">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td>图片主题:<input name="zt" type="text" class="inputtext" size="30" maxlength="100"></td></tr>
<tr><td>标题:<input name="title" type="text" class="inputtext" id="title" size="65"></td></tr>
<tr>
<td colspan="2" align="left" id="upid2">
<label>
<select name="small_class_id" id="small_class_id">
<option value="52">第1-8类商品</option>
<option value="44">第9-14类商品 </option>
<option value="79">第15-19类商品</option>
<option value="124">第20-22类商品</option>
</select>
</label> </td>
</tr>
<tr height="25">
<td colspan="2" align="left" id="upid"><input type="file" name="file1"></td>
</tr>
<tr height="25">
<td colspan="2" align="left" id="upid"> </td>
</tr>
<tr height="25">
<td colspan="2" align="center">
<input type="submit" value=" 发 送 " name="cmdOk" class="inputbox" style="font-family: 宋体; font-size: 9pt;">
<input type="reset" name="Submit2" value=" 重 设 " class="inputbox" style="font-family: 宋体; font-size: 9pt;"> </td>
</tr>
</table>
</form>
</body>
</html>
展开全部
<!--#include FILE="upload_5xsoft.inc"-->
set upload=new upload_5xsoft
for each formName in upload.objFile
set file=upload.file(formName) ''生成一个文件对象
……代码略
next
set upload=new upload_5xsoft
for each formName in upload.objFile
set file=upload.file(formName) ''生成一个文件对象
……代码略
next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在蓝色理想有个例子,是一个做相册的。但用到了SoftArtisans.FileUp这个组件上传,不知道你的空间支持这个组件不。据我了解,现在一般的ASP空间都支持这个组件。如果你的空间支持组件上传,最好不要用无组件上传的方法。至于好外嘛,就是速度快,稳定,服务器负担小
http://www.blueidea.com/tech/program/2003/1181.asp
http://www.blueidea.com/tech/program/2003/1181.asp
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用化境无组件的ASP上传程序就可以了
可以百度搜索一下
可以百度搜索一下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询