asp怎样上传文件到指定的文件夹,并在access中记录路径
我自己做了一个网站,想上传文件到指定的文件夹,并在access中记录路径,在asp页面中显示所上传的软件,点击直接下载功能。注意:是上传文件,不是图片。文件包括exe、r...
我自己做了一个网站,想上传文件到指定的文件夹,并在access中记录路径,在asp页面中显示所上传的软件,点击直接下载功能。
注意:是上传文件,不是图片。文件包括exe、rar、zip、doc、jpg等等。
我要的不是上传照片的程序,是上传文件,请看好。谢谢 展开
注意:是上传文件,不是图片。文件包括exe、rar、zip、doc、jpg等等。
我要的不是上传照片的程序,是上传文件,请看好。谢谢 展开
3个回答
展开全部
上传文件页 index.asp 开始
-----------------------------
index.asp 代码如下
<SCRIPT language=JavaScript type=text/javascript>
function a(htmlurl) {
var win = window.open(htmlurl,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=300,height=10,left=380,top=380");
}
</SCRIPT>
<form name="zc" action="index.asp" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td height="30" align="right" style="color:#666">汽车照片: </td>
<td><input type="text" name="qczp" class="zc_input" maxlength="100" value="<%=session("qczp")%>" readonly></td>
<td bgcolor="#E7F8F8" style="color:#666"><input type="button" value="上传图片" onClick="a('uploadprod.asp');" name="button" style="color:#666; width:60px; height:20px;"></td>
</tr>
</form>
</table>
上传文件页 index.asp 结束
-----------------------------
uploadprod.asp 选择图片上传 开始
-----------------------------
uploadprod.asp 代码如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>上传图片</title>
<link href="../images/cnge_wy.css" rel="stylesheet" type="text/css" />
<script>
function check()
{
var mf=document.up;
if (mf.image.value.length<4)
{
alert("请选择需要上传的图片.");
mf.image.focus();
return false;
}
return true;
}
</script>
<script language="JavaScript">
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
</script>
</head>
<body onselectstart="return false" oncopy="return false" oncut="return false" onpaste="return false" oncontextmenu="return false">
<%
response.buffer=true
const page_level=1
%>
<table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="2" align="center" height="25" style="font-weight:bold;">上传图片</td>
</tr>
<form name="up" method="post" action="uploadprod2.asp" enctype="multipart/form-data" onsubmit='return check();'>
<tr>
<td width="50%" align="right" height="25">选择图片:</td>
<td width="50%"><input type="file" name="image" style="border:1px solid #cdcdcd;"></td>
</tr>
<tr>
<td colspan="2" height="25" align="center"><input type="submit" value="提 交" name="Submit" style="width:45px; height:18px; border:1px solid #cdcdcd; color:#666; background-color:#FFFFFF;">
<input type="reset" value="重 置" style="width:45px; height:18px; border:1px solid #cdcdcd; color:#666; background-color:#FFFFFF;"></td>
</tr>
</form>
</table>
</body>
</html>
上传文件页 uploadprod.asp 结束
-----------------------------
判断文件以及文件是否存在则上传 uploadprod2.asp 开始
-----------------------------
uploadprod2.asp 源代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>图片上传</title>
<link href="../images/cnge_wy.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
</script>
</head>
<body onselectstart="return false" oncopy="return false" oncut="return false" onpaste="return false" oncontextmenu="return false">
<% response.buffer=true
session("path1")=""
const page_level=1
%>
<!--#include file=zupload.asp-->
<%
AllowFileExtStr = "jpg,gif,png,bmp"
dim ID
dim upload,path,file1,filename1
set upload=new upload_5xSoft'建立上传对象
'图片上传
formPath="../Carpic/"'上传图片目录
'开始上传图片
set file1=upload.file("image")
filename1=year(now())&"-"&month(now())&"-"&day(now())&"_"&hour(now())&"-"&Minute(now())&"-"&Second(now()) & right(file1.FileName,4)
if file1.FileSize>0 then'如果 FileSize > 0 说明有文件数据
FileExtName=mid (file1.FileName,InStrRev (file1.FileName, ".")+1)
if CheckFileType(AllowFileExtStr,FileExtName) = False then
response.Write file1.FileName & "<br><font color=red>文件:不允许上传!<br>上传文件类型有:" & AllowFileExtStr &"</font>"
response.Write "<br>"
response.Write "你的IP:"&Replace(Request.ServerVariables("REMOTE_ADDR"),"'","")&""
response.Write "<br>"
response.write "你的操作已被系统所记录!"
response.End()
end if
file1.SaveAs Server.mappath(formPath&filename1)'保存文件
'上传图片成功
path1= "/Carpic/"&filename1
else
response.write "请选择要插入的图片文件"
end if
session("qczp")=path1
%>
<p>图片上传成功.
<script language=javascript>
alert("图片上传成功!");
opener.document.zc.qczp.value="<%=path1%>";
window.close();
</script>
<%set file1=nothing
Function CheckFileType(AllowExtStr,FileExtName)
Dim i,AllowArray
AllowArray = Split(AllowExtStr,",")
FileExtName = LCase(FileExtName)
CheckFileType = False
For i = LBound(AllowArray) to UBound(AllowArray)
if LCase(AllowArray(i)) = LCase(FileExtName) then
CheckFileType = True
end if
Next
if FileExtName="asp" or FileExtName="asa" or FileExtName="aspx" or FileExtName="php" or FileExtName="php3" or FileExtName="php4" or FileExtName="php5" or FileExtName="exe" then
CheckFileType = False
end if
End Function
%>
%>
</body>
</html>
判断文件以及文件是否存在则上传 uploadprod2.asp 结束
-----------------------------
另外需要一个 上传组件 文件为 zupload.asp 开始
-----------------------------
代码如下
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
dim Data_5xsoft
Class upload_5xsoft
dim objForm,objFile,Version
Public function Form(strForm)
strForm=lcase(strForm)
if not objForm.exists(strForm) then
Form=""
else
Form=objForm(strForm)
end if
end function
Public function File(strFile)
strFile=lcase(strFile)
if not objFile.exists(strFile) then
set File=new FileInfo
else
set File=objFile(strFile)
end if
end function
Private Sub Class_Initialize
dim RequestData,sStart,vbCrlf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,theFile
dim iFileSize,sFilePath,sFileType,sFormValue,sFileName
dim iFindStart,iFindEnd
dim iFormStart,iFormEnd,sFormName
Version="上传程序 Version 2.0"
set objForm=Server.CreateObject("Scripting.Dictionary")
set objFile=Server.CreateObject("Scripting.Dictionary")
if Request.TotalBytes<1 then Exit Sub
set tStream = Server.CreateObject("adodb.stream")
set Data_5xsoft = Server.CreateObject("adodb.stream")
Data_5xsoft.Type = 1
Data_5xsoft.Mode =3
Data_5xsoft.Open
Data_5xsoft.Write Request.BinaryRead(Request.TotalBytes)
Data_5xsoft.Position=0
RequestData =Data_5xsoft.Read
iFormStart = 1
iFormEnd = LenB(RequestData)
vbCrlf = chrB(13) & chrB(10)
sStart = MidB(RequestData,1, InStrB(iFormStart,RequestData,vbCrlf)-1)
iStart = LenB (sStart)
iFormStart=iFormStart+iStart+1
while (iFormStart + 10) < iFormEnd
iInfoEnd = InStrB(iFormStart,RequestData,vbCrlf & vbCrlf)+3
tStream.Type = 1
tStream.Mode =3
tStream.Open
Data_5xsoft.Position = iFormStart
Data_5xsoft.CopyTo tStream,iInfoEnd-iFormStart
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sInfo = tStream.ReadText
tStream.Close
'取得表单项目名称
iFormStart = InStrB(iInfoEnd,RequestData,sStart)
iFindStart = InStr(22,sInfo,"name=""",1)+6
iFindEnd = InStr(iFindStart,sInfo,"""",1)
sFormName = lcase(Mid (sinfo,iFindStart,iFindEnd-iFindStart))
'如果是文件
if InStr (45,sInfo,"filename=""",1) > 0 then
set theFile=new FileInfo
'取得文件名
iFindStart = InStr(iFindEnd,sInfo,"filename=""",1)+10
iFindEnd = InStr(iFindStart,sInfo,"""",1)
sFileName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
theFile.FileName=getFileName(sFileName)
theFile.FilePath=getFilePath(sFileName)
'取得文件类型
iFindStart = InStr(iFindEnd,sInfo,"Content-Type: ",1)+14
iFindEnd = InStr(iFindStart,sInfo,vbCr)
theFile.FileType =Mid (sinfo,iFindStart,iFindEnd-iFindStart)
theFile.FileStart =iInfoEnd
theFile.FileSize = iFormStart -iInfoEnd -3
theFile.FormName=sFormName
if not objFile.Exists(sFormName) then
objFile.add sFormName,theFile
end if
else
'如果是表单项目
tStream.Type =1
tStream.Mode =3
tStream.Open
Data_5xsoft.Position = iInfoEnd
Data_5xsoft.CopyTo tStream,iFormStart-iInfoEnd-3
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sFormValue = tStream.ReadText
tStream.Close
if objForm.Exists(sFormName) then
objForm(sFormName)=objForm(sFormName)&", "&sFormValue
else
objForm.Add sFormName,sFormValue
end if
end if
iFormStart=iFormStart+iStart+1
wend
RequestData=""
set tStream =nothing
End Sub
Private Sub Class_Terminate
if Request.TotalBytes>0 then
objForm.RemoveAll
objFile.RemoveAll
set objForm=nothing
set objFile=nothing
Data_5xsoft.Close
set Data_5xsoft =nothing
end if
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
End Class
Class FileInfo
dim FormName,FileName,FilePath,FileSize,FileType,FileStart
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
FileType = ""
End Sub
Public function SaveAs(FullPath)
dim dr,ErrorChar,i
SaveAs=true
if trim(fullpath)="" or FileStart=0 or FileName="" or right(fullpath,1)="/" then exit function
set dr=CreateObject("Adodb.Stream")
dr.Mode=3
dr.Type=1
dr.Open
Data_5xsoft.position=FileStart
Data_5xsoft.copyto dr,FileSize
dr.SaveToFile FullPath,2
dr.Close
set dr=nothing
SaveAs=false
end function
End Class
</SCRIPT>
另外需要一个 上传组件 文件为 zupload.asp 结束
-----------------------------
另需要建立一个文件夹来 存放文件
我是用的 formPath="../Carpic/"'上传图片目录
也就是说本程序的上面一个文件夹为 Carpic
-----------------------------------------------------------------
全部完成,绝对能行。。。。。。
-----------------------------
index.asp 代码如下
<SCRIPT language=JavaScript type=text/javascript>
function a(htmlurl) {
var win = window.open(htmlurl,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=300,height=10,left=380,top=380");
}
</SCRIPT>
<form name="zc" action="index.asp" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td height="30" align="right" style="color:#666">汽车照片: </td>
<td><input type="text" name="qczp" class="zc_input" maxlength="100" value="<%=session("qczp")%>" readonly></td>
<td bgcolor="#E7F8F8" style="color:#666"><input type="button" value="上传图片" onClick="a('uploadprod.asp');" name="button" style="color:#666; width:60px; height:20px;"></td>
</tr>
</form>
</table>
上传文件页 index.asp 结束
-----------------------------
uploadprod.asp 选择图片上传 开始
-----------------------------
uploadprod.asp 代码如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>上传图片</title>
<link href="../images/cnge_wy.css" rel="stylesheet" type="text/css" />
<script>
function check()
{
var mf=document.up;
if (mf.image.value.length<4)
{
alert("请选择需要上传的图片.");
mf.image.focus();
return false;
}
return true;
}
</script>
<script language="JavaScript">
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
</script>
</head>
<body onselectstart="return false" oncopy="return false" oncut="return false" onpaste="return false" oncontextmenu="return false">
<%
response.buffer=true
const page_level=1
%>
<table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="2" align="center" height="25" style="font-weight:bold;">上传图片</td>
</tr>
<form name="up" method="post" action="uploadprod2.asp" enctype="multipart/form-data" onsubmit='return check();'>
<tr>
<td width="50%" align="right" height="25">选择图片:</td>
<td width="50%"><input type="file" name="image" style="border:1px solid #cdcdcd;"></td>
</tr>
<tr>
<td colspan="2" height="25" align="center"><input type="submit" value="提 交" name="Submit" style="width:45px; height:18px; border:1px solid #cdcdcd; color:#666; background-color:#FFFFFF;">
<input type="reset" value="重 置" style="width:45px; height:18px; border:1px solid #cdcdcd; color:#666; background-color:#FFFFFF;"></td>
</tr>
</form>
</table>
</body>
</html>
上传文件页 uploadprod.asp 结束
-----------------------------
判断文件以及文件是否存在则上传 uploadprod2.asp 开始
-----------------------------
uploadprod2.asp 源代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>图片上传</title>
<link href="../images/cnge_wy.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
</script>
</head>
<body onselectstart="return false" oncopy="return false" oncut="return false" onpaste="return false" oncontextmenu="return false">
<% response.buffer=true
session("path1")=""
const page_level=1
%>
<!--#include file=zupload.asp-->
<%
AllowFileExtStr = "jpg,gif,png,bmp"
dim ID
dim upload,path,file1,filename1
set upload=new upload_5xSoft'建立上传对象
'图片上传
formPath="../Carpic/"'上传图片目录
'开始上传图片
set file1=upload.file("image")
filename1=year(now())&"-"&month(now())&"-"&day(now())&"_"&hour(now())&"-"&Minute(now())&"-"&Second(now()) & right(file1.FileName,4)
if file1.FileSize>0 then'如果 FileSize > 0 说明有文件数据
FileExtName=mid (file1.FileName,InStrRev (file1.FileName, ".")+1)
if CheckFileType(AllowFileExtStr,FileExtName) = False then
response.Write file1.FileName & "<br><font color=red>文件:不允许上传!<br>上传文件类型有:" & AllowFileExtStr &"</font>"
response.Write "<br>"
response.Write "你的IP:"&Replace(Request.ServerVariables("REMOTE_ADDR"),"'","")&""
response.Write "<br>"
response.write "你的操作已被系统所记录!"
response.End()
end if
file1.SaveAs Server.mappath(formPath&filename1)'保存文件
'上传图片成功
path1= "/Carpic/"&filename1
else
response.write "请选择要插入的图片文件"
end if
session("qczp")=path1
%>
<p>图片上传成功.
<script language=javascript>
alert("图片上传成功!");
opener.document.zc.qczp.value="<%=path1%>";
window.close();
</script>
<%set file1=nothing
Function CheckFileType(AllowExtStr,FileExtName)
Dim i,AllowArray
AllowArray = Split(AllowExtStr,",")
FileExtName = LCase(FileExtName)
CheckFileType = False
For i = LBound(AllowArray) to UBound(AllowArray)
if LCase(AllowArray(i)) = LCase(FileExtName) then
CheckFileType = True
end if
Next
if FileExtName="asp" or FileExtName="asa" or FileExtName="aspx" or FileExtName="php" or FileExtName="php3" or FileExtName="php4" or FileExtName="php5" or FileExtName="exe" then
CheckFileType = False
end if
End Function
%>
%>
</body>
</html>
判断文件以及文件是否存在则上传 uploadprod2.asp 结束
-----------------------------
另外需要一个 上传组件 文件为 zupload.asp 开始
-----------------------------
代码如下
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
dim Data_5xsoft
Class upload_5xsoft
dim objForm,objFile,Version
Public function Form(strForm)
strForm=lcase(strForm)
if not objForm.exists(strForm) then
Form=""
else
Form=objForm(strForm)
end if
end function
Public function File(strFile)
strFile=lcase(strFile)
if not objFile.exists(strFile) then
set File=new FileInfo
else
set File=objFile(strFile)
end if
end function
Private Sub Class_Initialize
dim RequestData,sStart,vbCrlf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,theFile
dim iFileSize,sFilePath,sFileType,sFormValue,sFileName
dim iFindStart,iFindEnd
dim iFormStart,iFormEnd,sFormName
Version="上传程序 Version 2.0"
set objForm=Server.CreateObject("Scripting.Dictionary")
set objFile=Server.CreateObject("Scripting.Dictionary")
if Request.TotalBytes<1 then Exit Sub
set tStream = Server.CreateObject("adodb.stream")
set Data_5xsoft = Server.CreateObject("adodb.stream")
Data_5xsoft.Type = 1
Data_5xsoft.Mode =3
Data_5xsoft.Open
Data_5xsoft.Write Request.BinaryRead(Request.TotalBytes)
Data_5xsoft.Position=0
RequestData =Data_5xsoft.Read
iFormStart = 1
iFormEnd = LenB(RequestData)
vbCrlf = chrB(13) & chrB(10)
sStart = MidB(RequestData,1, InStrB(iFormStart,RequestData,vbCrlf)-1)
iStart = LenB (sStart)
iFormStart=iFormStart+iStart+1
while (iFormStart + 10) < iFormEnd
iInfoEnd = InStrB(iFormStart,RequestData,vbCrlf & vbCrlf)+3
tStream.Type = 1
tStream.Mode =3
tStream.Open
Data_5xsoft.Position = iFormStart
Data_5xsoft.CopyTo tStream,iInfoEnd-iFormStart
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sInfo = tStream.ReadText
tStream.Close
'取得表单项目名称
iFormStart = InStrB(iInfoEnd,RequestData,sStart)
iFindStart = InStr(22,sInfo,"name=""",1)+6
iFindEnd = InStr(iFindStart,sInfo,"""",1)
sFormName = lcase(Mid (sinfo,iFindStart,iFindEnd-iFindStart))
'如果是文件
if InStr (45,sInfo,"filename=""",1) > 0 then
set theFile=new FileInfo
'取得文件名
iFindStart = InStr(iFindEnd,sInfo,"filename=""",1)+10
iFindEnd = InStr(iFindStart,sInfo,"""",1)
sFileName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
theFile.FileName=getFileName(sFileName)
theFile.FilePath=getFilePath(sFileName)
'取得文件类型
iFindStart = InStr(iFindEnd,sInfo,"Content-Type: ",1)+14
iFindEnd = InStr(iFindStart,sInfo,vbCr)
theFile.FileType =Mid (sinfo,iFindStart,iFindEnd-iFindStart)
theFile.FileStart =iInfoEnd
theFile.FileSize = iFormStart -iInfoEnd -3
theFile.FormName=sFormName
if not objFile.Exists(sFormName) then
objFile.add sFormName,theFile
end if
else
'如果是表单项目
tStream.Type =1
tStream.Mode =3
tStream.Open
Data_5xsoft.Position = iInfoEnd
Data_5xsoft.CopyTo tStream,iFormStart-iInfoEnd-3
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sFormValue = tStream.ReadText
tStream.Close
if objForm.Exists(sFormName) then
objForm(sFormName)=objForm(sFormName)&", "&sFormValue
else
objForm.Add sFormName,sFormValue
end if
end if
iFormStart=iFormStart+iStart+1
wend
RequestData=""
set tStream =nothing
End Sub
Private Sub Class_Terminate
if Request.TotalBytes>0 then
objForm.RemoveAll
objFile.RemoveAll
set objForm=nothing
set objFile=nothing
Data_5xsoft.Close
set Data_5xsoft =nothing
end if
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
End Class
Class FileInfo
dim FormName,FileName,FilePath,FileSize,FileType,FileStart
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
FileType = ""
End Sub
Public function SaveAs(FullPath)
dim dr,ErrorChar,i
SaveAs=true
if trim(fullpath)="" or FileStart=0 or FileName="" or right(fullpath,1)="/" then exit function
set dr=CreateObject("Adodb.Stream")
dr.Mode=3
dr.Type=1
dr.Open
Data_5xsoft.position=FileStart
Data_5xsoft.copyto dr,FileSize
dr.SaveToFile FullPath,2
dr.Close
set dr=nothing
SaveAs=false
end function
End Class
</SCRIPT>
另外需要一个 上传组件 文件为 zupload.asp 结束
-----------------------------
另需要建立一个文件夹来 存放文件
我是用的 formPath="../Carpic/"'上传图片目录
也就是说本程序的上面一个文件夹为 Carpic
-----------------------------------------------------------------
全部完成,绝对能行。。。。。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询