“稻香老农”那个无组件文件上传程序需要空间支持什么?

QYworld 2002-03-02 01:05:13
就是这个:

http://www.5xsoft.com/data/200104/2822340301.htm

好像我空间用不了是的,什么空间都能用吗?
...全文
116 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
airlulu 2002-10-12
  • 打赏
  • 举报
回复
这东西怎么用啊?给个说明行吗?
muddledman 2002-03-04
  • 打赏
  • 举报
回复
好东西,不错!向ChinaOk(蓝蝶)致意!
ChinaOk 2002-03-03
  • 打赏
  • 举报
回复
我整理到这里了。你下吧。

www.ChinaOK.net/down/upload.rar
QYworld 2002-03-03
  • 打赏
  • 举报
回复
真是太谢谢你了,可惜这帖子我给分少了,真应该给你100分!!!

你这东西真不错
muddledman 2002-03-02
  • 打赏
  • 举报
回复
能说明一下吗?如何使用!
ChinaOk 2002-03-02
  • 打赏
  • 举报
回复
=========================upfile.asp========================
<%
if Session("master")="" then response.redirect "login.asp"
dim rndInt
randomize
rndInt=round(rnd()*65535)+1
Session("formid")=rndInt
dim isSetVar
isSetVar=0
%>
<html>
<head>
<title>蓝蝶精品网... Web Document Explorer.....</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="admin.css" type="text/css">
<script language="javascript">
var UpTure=false;
var FilePath="upload.asp?fid=<%=rndInt%>";
function setid()
{ str='<br>';
if(!window.form1.upcount.value)
window.form1.upcount.value=1;
for(i=1;i<=window.form1.upcount.value;i++)
str+='文件'+i+':<input type="file" name="file'+i+'" style="width:400" class="tx1"><br><br>';
window.upid.innerHTML=str+'<br>';
}
function check()
{var upno=0;
var info="";
for(i=1;i<=window.form1.upcount.value;i++)
{eval("var ncd=document.form1.file"+i+".value;");
if (ncd!="") var nstr=findname(ncd);
if (typeof(nstr)=="undefined" || nstr==""){alert("找不到你要上传的文件~!\n请重新选择");return false;}
else {upno++;
info+="文件" + upno + ":\n 本地路径=" +ncd+ "\n 文件名:" + nstr + "\n";
}
}
var fpath=document.form1.filepath.value;
if (fpath=="")fpath="根目录"
flag=window.confirm("你要上传的文件是: \n"+info+"\n"+"上传路径名为: "+fpath);
if (!flag) return false;
fpath=FilePath+"&filepath="+document.form1.filepath.value;
document.form1.action=fpath;
return true;
}
function findname(vl)
{var no0=vl.lastIndexOf("\\");
var no1=vl.lastIndexOf(".");
var no2=vl.indexOf(":");
if (no0==-1 || no1==-1 || no2!=1 || no0>no1) return ;
var fname=vl.substr(no0+1);
return fname;
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" oncontextmenu=self.event.returnValue=false >
<form name="form1" method="post" action="upload.asp" enctype="multipart/form-data" onsubmit="return check()">
<table border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#CCCCCC" width="91" height="23">
<tr>
<td align="left" valign="middle" height="18" width="18"> </td>
<td bgcolor="#CCCCCC" align="left" valign="middle" height="18" width="67">文件上传</td>
</tr>
</table>
<br>
<input type="hidden" name="act" value="upload">
<br>
<table width="542" border="1" cellspacing="0" cellpadding="5" align="center" bordercolordark="#CCCCCC" bordercolorlight="#000000">
<tr bgcolor="#CCCCCC">
<td height="22" align="left" valign="middle" bgcolor="#CCCCCC" width="540">蓝 蝶 精 品 网... Web Document Explorer ...文件上传</td>
</tr>
<tr align="left" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="92" width="540">
<li> 需要上传的个数
<input type="text" name="upcount" class="tx" value="1" onchange="setid();">
</li>
<br>
<br>
<li>上传到:
<SELECT id=filepath name=filepath class=bt style="width:140pt;font-size:9pt"><script language="Javascript" src="folder.js">
</script>
</SELECT> </li>
</td>
</tr>
<tr align="center" valign="middle">
<td align="center" height="22" width="540">☆ <font color=red>注意文件名不要重复!</font> ☆
</td>
</tr>
<tr align="center" valign="middle">
<td align="left" id="upid" height="122" width="540"> 文件1:
<input type="file" name="file1" style="width:400" class="tx1" value="">
</td>
</tr>
<tr align="center" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="24" width="540">
<input type="submit" name="Submit" value="· 提交 ·" disabled class="bt">
<input type="reset" name="Submit2" value="· 重执 ·" class="bt" onclick="setTimeout('setid();',100);">
</td>
</tr>
</table>
</form>
<script language="javascript">
setid();
if (UpTrue) {document.form1.Submit.disabled=0;}
</script>
</body>
</html>
ChinaOk 2002-03-02
  • 打赏
  • 举报
回复
=======================upload_class.asp================
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
dim upfile_Stream

Class upload_file

dim Form,File,Version,Count,sCount

Private Sub Class_Initialize
dim iStart,iFileNameStart,iFileNameEnd,iEnd,vbEnter,iFormStart,iFormEnd,theFile
dim strDiv,mFormName,mFormValue,mFileName,mFileSize,mFilePath,iDivLen,mStr
Version="蓝蝶精品网www.ChinaOK.net[改自盗香老农]"
Count=0
sCount=0
dim theUpPath,theMapPath
theMapPath=server.MapPath("..") '注意路径问题。
if right(theMapPath,1)<>"\" then theMapPath=theMapPath&"\"
theUpPath=theMapPath&Request.QueryString("filepath")
'Response.Write theUpPath
if Request.TotalBytes<1 then Exit Sub
'set Form=server.CreateObject("Scripting.Dictionary")
'set File=server.CreateObject("Scripting.Dictionary")
set upfile_Stream=CreateObject("Adodb.Stream")

upfile_Stream.mode=3
upfile_Stream.type=1
upfile_Stream.open
upfile_Stream.write Request.BinaryRead(Request.TotalBytes)

vbEnter=Chr(13)&Chr(10)
iDivLen=inString(1,vbEnter)+1
strDiv=subString(1,iDivLen)
iFormStart=iDivLen
iFormEnd=inString(iformStart,strDiv)-1
while iFormStart < iFormEnd
iStart=inString(iFormStart,"name=""")
iEnd=inString(iStart+6,"""")
mFormName=subString(iStart+6,iEnd-iStart-6)
iFileNameStart=inString(iEnd+1,"filename=""")
if iFileNameStart>0 and iFileNameStart<iFormEnd then
iFileNameEnd=inString(iFileNameStart+10,"""")
mFileName=subString(iFileNameStart+10,iFileNameEnd-iFileNameStart-10)
iStart=inString(iFileNameEnd+1,vbEnter&vbEnter)
iEnd=inString(iStart+4,vbEnter&strDiv)
if iEnd>iStart then
mFileSize=iEnd-iStart-4
else
mFileSize=0
end if
set theFile=new FileInfo
theFile.FileName=getFileName(mFileName)
theFile.FilePath=getFilePath(mFileName)
theFile.FileSize=mFileSize
theFile.FileStart=iStart+4
theFile.FormName=FormName
'File.add mFormName,theFile
'/+++++++++++++++++++++++++++
if mFileSize>0 then
theFile.SaveAs theUpPath&theFile.FileName 'mformPath&file.FileName
Count=Count+1
sCount=sCount+1
theFile.PrintInfo theFile,theUpPath&theFile.FileName
else
Count=Count+1
theFile.PrintInfo theFile,theUpPath&theFile.FileName
end if
'++++++++++++++++/
else
iStart=inString(iEnd+1,vbEnter&vbEnter)
iEnd=inString(iStart+4,vbEnter&strDiv)

if iEnd>iStart then
mFormValue=subString(iStart+4,iEnd-iStart-4)
else
mFormValue=""
end if
'form.Add mFormName,mFormValue
' Response.Write "$"&cstr(mFormName)&"|"&cstr(mFormValue)
end if

iFormStart=iformEnd+iDivLen
iFormEnd=inString(iformStart,strDiv)-1
wend
End Sub

'注释
Private Function subString(theStart,theLen)
dim i,c,stemp
upfile_Stream.Position=theStart-1
stemp=""
for i=1 to theLen
if upfile_Stream.EOS then Exit for
c=ascB(upfile_Stream.Read(1))
If c > 127 Then
if upfile_Stream.EOS then Exit for
stemp=stemp&Chr(AscW(ChrB(AscB(upfile_Stream.Read(1)))&ChrB(c)))
i=i+1
else
stemp=stemp&Chr(c)
End If
Next
subString=stemp
End function

'注释
Private Function inString(theStart,varStr)
dim i,j,bt,theLen,str
InString=0
Str=toByte(varStr) '将文字变为十六进制的串
theLen=LenB(Str)
for i=theStart to upfile_Stream.Size-theLen
if i>upfile_Stream.size then exit Function
upfile_Stream.Position=i-1
if AscB(upfile_Stream.Read(1))=AscB(midB(Str,1)) then
InString=i
for j=2 to theLen
if upfile_Stream.EOS then
inString=0
Exit for
end if
if AscB(upfile_Stream.Read(1))<>AscB(MidB(Str,j,1)) then
InString=0
Exit For
end if
next
if InString<>0 then Exit Function
end if
next
End Function
'释放类
Private Sub Class_Terminate
' form.RemoveAll
' file.RemoveAll
'set form=nothing
' set file=nothing
upfile_Stream.close
set upfile_Stream=nothing
End Sub

'取得文件的正确路径
Private function GetFilePath(FullPath)
If FullPath <> "" Then
GetFilePath = left(FullPath,InStrRev(FullPath, "\"))
Else
GetFilePath = ""
End If
End function
'取得文件的名字
Private function GetFileName(FullPath)
If FullPath <> "" Then
GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1)
Else
GetFileName = ""
End If
End function
'将字符串变为二进制的串
Private function toByte(Str)
dim i,iCode,c,iLow,iHigh
toByte=""
For i=1 To Len(Str)
c=mid(Str,i,1)
iCode =Asc(c)
If iCode<0 Then iCode = iCode + 65535
If iCode>255 Then
iLow = Left(Hex(Asc(c)),2)
iHigh =Right(Hex(Asc(c)),2)
toByte = toByte & chrB("&H"&iLow) & chrB("&H"&iHigh)
Else
toByte = toByte & chrB(AscB(c))
End If
Next
End function
End Class

'初始化, 保存文件
Class FileInfo
dim FormName,FileName,FilePath,FileSize,FileStart
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
End Sub
'保存文件,从 upfile_Stream里截取文件
Public function SaveAs(FullPath)
dim dr,ErrorChar,i
SaveAs=1
if trim(fullpath)="" or FileSize=0 or FileStart=0 or FileName="" then exit function
if FileStart=0 or right(fullpath,1)="/" then exit function
set dr=CreateObject("Adodb.Stream")
dr.Mode=3
dr.Type=1
dr.Open
upfile_Stream.position=FileStart-1
upfile_Stream.copyto dr,FileSize
dr.SaveToFile FullPath,2
dr.Close
set dr=nothing
SaveAs=0
End function
'输出文件信息
Public sub PrintInfo(theFile,fullpath)
dim str_print
str_print= "<li>本地路径:"&theFile.FilePath&theFile.FileName&"   <font color=#ff00cc>大小</font>:"&theFile.FileSize&" Byte<br>  上传路径: "&FullPath
if theFile.FileSize>0 then
str_print=str_print & "   <font color=red>成功!</font>"
else str_print=str_print & "   <font color=red>失败!</font>"
end if
Response.Write str_print
End sub
End Class

</SCRIPT>
ChinaOk 2002-03-02
  • 打赏
  • 举报
回复
稍等。我把我改过的贴出来。不过改的不太好。但为了减少其他限制,只能是走曲线救国了。哈哈。

muddledman 2002-03-02
  • 打赏
  • 举报
回复
ChinaOk(蓝蝶),你是否有着这方面的源码?贴出来,让我们学习一下!
muddledman 2002-03-02
  • 打赏
  • 举报
回复
gz
ChinaOk 2002-03-02
  • 打赏
  • 举报
回复
他的那个用了CreateObject("Scripting.Dictionary")使的一般的空间都不支持了。
如果去掉了这个东西。换个方式实现可以的就可以只要支持adodb.stream就可以了。
QYworld 2002-03-02
  • 打赏
  • 举报
回复
我试了试,好像有错误

谁提供个完整的下载?谢谢了,实在没时间一点点去看,去改了
QYworld 2002-03-02
  • 打赏
  • 举报
回复
这样基本在所有空间就能用了吗?

代码好长,要用段时间研究了,不知道你有没有做好的现成的例子?
ChinaOk 2002-03-02
  • 打赏
  • 举报
回复
将最后一个文件存为folder.js
刚才忘写了。
ChinaOk 2002-03-02
  • 打赏
  • 举报
回复
var s;
s+="<OPTION selected style=\"COLOR:#000000\" value=\"\">根目录</OPTION>";
s+="<option style=\"COLOR:#6606ff\" value=\"admin\\\">├Admin</option>";
s+="<option style=\"COLOR:#6606ff\" value=\"index\\\">├Index</option>";
s+="<option style=\"COLOR:#660066\" value=\"images\\\">├Images</option>";
s+="<option style=\"COLOR:#9900ff\" value=\"service\\\">├Service</option>";
s+="<option style=\"COLOR:#ff0000\" value=\"upload\\\">├UpLoad</option>";
s+="<option style=\"COLOR:#0060ff\" value=\"liuyan\\\">├LiuYan</option>";
s+="<option style=\"COLOR:#996090\" value=\"liuyan\\images\\\">│ ├Images</option>";
s+="<option style=\"COLOR:#55c0ff\" value=\"funpic\\\">├FunPic</option>";
s+="<option style=\"COLOR:#cc55ff\" value=\"funpic\\images\\\">│ ├Images</option>";
s+="<option style=\"COLOR:#ffc05c\" value=\"bbs\\\">├BBS</option>";
s+="<option style=\"COLOR:#dc80cf\" value=\"bbs\\images\\\">│ ├Images</option>";
s+="<option style=\"COLOR:#0080cf\" value=\"bbs\\sysfile\\\">│ ├SysFile</option>";
document.write (s);
UpTrue=true;
ChinaOk 2002-03-02
  • 打赏
  • 举报
回复
好了。
现在我就可以继续帖了。这里不让连续帖3个以上的。
========================upload.asp================
<%OPTION EXPLICIT%>
<%
if Session("master")="" then response.redirect "login.asp"
dim rndInt
rndInt=cstr(Request.QueryString("fid"))
if strcomp(rndInt,session("formid"))<>0 then HtmEnd "请不要重复递交!",1,"upfile.asp"
session("formid")="0"

Server.ScriptTimeOut=5000

sub HtmEnd(info,isback,dir)
if info<>"" then Response.Write("<script language=""javascript"">alert('"&info&"');</script>")
select case isback
case 1
Response.Write("<script language=""javascript"">history.back();</script>")
case 2
Response.Write("<script language=""javascript"">location.href='"&dir&"';</script>")
end select
Response.write("</body></html>")
Response.End
end sub
%>
<!--#include file="upload_class.asp"-->
<html>
<head>
<title>蓝蝶精品网... Web Document Explorer.....上传结果</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="admin.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" oncontextmenu=self.event.returnValue=false >
<table border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#CCCCCC" width="91" height="23">
<tr><td align="left" valign="middle" height="18" width="18"> </td>
<td bgcolor="#CCCCCC" align="left" valign="middle" height="18" width="67">文件上传</td>
</tr></table><br><br>
<table width="542" border="1" cellspacing="0" cellpadding="5" align="center" bordercolordark="#CCCCCC" bordercolorlight="#000000">
<tr bgcolor="#CCCCCC">
<td height="22" align="left" valign="middle" bgcolor="#CCCCCC" width="540">蓝 蝶 精 品 网... Web Document Explorer ...上传结果</td>
</tr>
<tr align="left" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="92" width="540">
<%iCount=0

dim upload,file,formName,formPath,iCount,act,sCount
set upload=new upload_file

iCount=upload.Count
sCount=upload.sCount
set upload=nothing ''删除此对象

%>
</td>
</tr>
<tr bgcolor="#dddddd">
<td height="22" align="left" valign="middle" bgcolor="#CCCCCC" width="540">共上传文件:<%=iCount%>个,成功上传<%=sCount%>个,上传失败<%=iCount-sCount%>个。</td>
</tr>
<tr align="center" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="24" width="540">
<input type=button value=返回 class=bt onclick="location.href='upfile.asp';" id=button1 name=button1>
<input type=button value=关闭 class=bt onclick="window.close();" id=button2 name=button2>
</td>
</tr>
</table>
</body>
</html>

28,406

社区成员

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

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