一个的无组件上传的ASP代码

2016-01-29 17:39 9 1 收藏

一个的无组件上传的ASP代码,一个的无组件上传的ASP代码

【 tulaoshi.com - ASP 】

  <!--#include file="../lib/filelib.asp"--
<%
    Response.write "<title上传文件至当前文件夹</title"
    Response.Write "<body bgcolor=""#D6D3CE"" leftmargin=""0"" topmargin=""0"" title = ""    请您遵守国家相关法律法规上传文件。上传前请杀毒,否则系统将会自动删除此文件!"""

'**Start Encode**
Action=Request("A")
If Action="UL" Then
        DoUpload Request.Cookies("DAZHOU.NET")("nowpath") & ""
        'CheckDiskSpace
'        Response.redirect "fileman.asp"
Else
    ShowUploadForm
End If

Set fso=Nothing
'========================
SUB ShowUploadForm
'========================
    Response.write "<Dir<form enctype=multipart/form-data name=fmupload method=Post action=Upload.asp?A=UL<br"
    If Request("n")<"" AND IsNumeric(Request("n")) Then Session("NumUploadFields")=CInt(Request("n"))
    For i=1 to 5
        Response.Write "<INPUT type=file name=file"& i & " size=35<br"
    Next
    Response.Write "<br<center<INPUT type=submit value=""开始上传""  <INPUT type='button' value= '取消上传' onclick='window.close()' "
    Response.Write "</form"
End SUB

'========================
SUB DoUpload(Dir)
'========================
    'If NOT Application("Debugging") Then On Error resume next
    StartTime=Now
    RequestBin=Request.BinaryRead(Request.TotalBytes)
    Set UploadRequest=CreateObject("Scripting.Dictionary")
    BuildUploadRequest RequestBin, UploadRequest
    keys=UploadRequest.Keys
    For i=0 to UploadRequest.Count - 1
        curKey=keys(i)
        fName=UploadRequest.Item(curKey).Item("FileName")

        If fso.FileExists(Dir & fName) Then fso.deletefile Dir & fName
        If fName<"" AND NOT fso.FileExists(Dir & fName) Then
            value=UploadRequest.Item(curKey).Item("Value")
            valueBeg=UploadRequest.Item(curKey).Item("ValueBeg")
            valueLen=UploadRequest.Item(curKey).Item("ValueLen")
            TotalULSize=TotalULSize + valueLen
            Set strm1=Server.CreateObject("ADODB.Stream")
            Set strm2=Server.CreateObject("ADODB.Stream")
            strm1.Open
            strm1.Type=1 'Binary
            strm2.Open
            strm2.Type=1 'Binary
   &nb

来源:https://www.tulaoshi.com/n/20160129/1502342.html

延伸阅读
//保存文件的路径,包括文件名 private string GetSavePath(string FileName) { string path=Request.PhysicalApplicationPath +"\\Link_Icon"; return path+"\\"+FileName; } private bool UpLoad()//上传图片 { bool flag=false; string FileName=GetFileName(fileIcon.Value ); string db=Request.PhysicalApplicationP...
标签: ASP
  最近在单位做的一个项目里需要有文件上传的功能,正好手头一本书的附赠光盘里有一个上传组件,心中大喜。可惜随之便发现这是一个试用版,不给钱就只能用50次,太小气了!!好在头头催得不紧,时间充裕,干脆自己试着做一个,既可长经验值,又能长成就感,不试白不试!以下介绍的便是俺折腾了两天半捣鼓出来的一个只能说是雏形的玩意,区...
标签: ASP
  保存为runasp.asp运行。账号密码admin,登陆后输入代码就可执行了!! <% @ LANGUAGE="VBSCRIPT" % <%Option Explicit response.buffer=true dim Spassword,SUserName     SUserName="admin"     Spassword="admin" dim SQLMutiStr dim i dim action     action=request.querystr...
标签: ASP
  在无组件上传我刚试成功,所以提供代码给大家一起共享。 /*  addemployee.asp   */ <html <head <title职工之家</title <meta http-equiv="Content-Type" content="text/html; charset=gb2312" <link rel="stylesheet" href="../css/site_css.css" type="text/css" </head <script language=...
标签: ASP
  编写定制的Active Server Page(ASP)代码来完成一些任务,比方说数据库访问的能力是重要的.但是,一个由脚本写成的解决方案最明显的问题就是性能.在这篇文章中,我将向你展示如何将一个数据库对象的脚本版本转换成一个动态链接库(dll),或是就象它的通常的名字,一个COM组件.为了生成这个编译版本,我将使用Visual Basic 6...

经验教程

274

收藏

17
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部