找回密码
 入住遨海湾
搜索
网站解决方案专享优惠-3折上云
查看: 1429|回复: 0

aspupload组件使用用法

[复制链接]
发表于 2007-2-2 11:47:00 | 显示全部楼层 |阅读模式

登录后查才能浏览下载更多咨询,有问题联系QQ:3283999

您需要 登录 才可以下载或查看,没有账号?入住遨海湾

×
 

<HTML>
<BODY>
<%
Set Upload = Server.CreateObject("Persits.Upload")
Upload.SetMaxSize 100000, True

Count = Upload.Save
Set File = Upload.Files("THEFILE")

If Not File Is Nothing Then
   Connect = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(".\aspupload.mdb")

   Set rs = Server.CreateObject("adodb.recordset")

   Hash = File.MD5Hash
   rs.Open "SELECT * from MYIMAGES WHERE Hash='" & Hash & "'", Connect, 2, 3
   If Not rs.EOF Then
      Response.Write "This file already exists in the database."
      Response.End
   End If
   rs.Close
   rs.Open "MYIMAGES", Connect, 2, 3

   rs.AddNew
   rs("image_blob") = File.Binary
   rs("filename") = File.FileName
   rs("filesize") = File.Size
   rs("hash") = Hash
   rs("deion") = Upload.Form("DESCR")
   rs.Update

   Response.Write "File saved."
Else
   Response.Write "File not selected."
End If
%>
</BODY>
</HTML>
 
 上传及显示图片的重要代码

<%
if Trim(Request.QueryString("act")="added" )  then
  Set rs = Server.CreateObject("ADODB.Recordset")
  rs.open "select * from pic",conn,1,3
  Set Upload = Server.CreateObject("Persits.Upload")
  Count = Upload.Save(server.mappath("/upload"))
  Set File = Upload.Files("picpath")
   picname = Upload.Form("picname")
   picpath="upload" & "/" & file.filename
   picsize=file.size
             Response.Write picpath
                  Response.Write "您上传成功了"
                            rs.addnew
rs("picname")=picname
rs("picpath")=picpath
rs("picsize")=picsize
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
不过aspload没有判断上传的文件是否文件,像dv_file可以通过文件头判断,更安装
遨海湾-心灵的港湾 www.aosea.com
您需要登录后才可以回帖 登录 | 入住遨海湾

本版积分规则

网站解决方案专享优惠-3折上云

QQ|手机版|小黑屋|遨海湾超级社区

GMT+8, 2024-11-22 07:56

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表