不用组件实现上载功能(英文NT)2.

'---- file name /handld_upload.asp

<% Option Explicit %>

<%
Response.Expires=0
Response.Buffer = TRUE
Response.Clear
Const IMAGE_SIZE = "width=""200"" height=""150"""
Dim UploadRequest
Set UploadRequest = Server.CreateObject("Scripting.Dictionary")

Dim byteCount, RequestBin
byteCount  = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)

BuildUploadRequest RequestBin

Dim saveURL, goURL, filepathname, value, filename
'---- save path
'saveURL      = UploadRequest.Item("saveURL").Item("Value")
saveURL      = "/"

'---- jump to file path when finish upload
goURL        = UploadRequest.Item("goURL").Item("Value")

filepathname = UploadRequest.Item("my_file").Item("FilePathName")
value        = UploadRequest.Item("my_file").Item("Value")
filename     = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))

'---- debug
'Response.Write saveURL&"**"&goURL&"**"&filepathname
'Response.Write "**"&filename
'Response.End

Dim fso, MyFile, i
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If NOT fso.FolderExists(Server.mappath(saveURL) & "\") Then
    RecMkDir(Server.mappath(saveURL) & "\")
End If
Set MyFile = fso.CreateTextFile(Server.mappath(saveURL) & "\" & filename)

For i = 1 to LenB(value)
    MyFile.Write chr(AscB(MidB(value,i,1)))
Next

MyFile.Close

Session("StoredFile") = filename
Session("strImage") = "<img src='" & saveURL &  filename & "'" & IMAGE_SIZE & " border=1 bordercolor=#0000FF>"

Response.Redirect goURL
%>
<!--#include file="upload.asp"-->

'---- file name /test.asp/
<% Option Explicit %>

<%
On Error Resume Next
Response.Expires = 0
Response.AddHeader "Pragma", "no-cache"

Dim thisFile
thisFile = Right(Request.ServerVariables("PATH_INFO"),Len(Request.ServerVariables("PATH_INFO"))-InStrRev(Request.ServerVariables("PATH_INFO"), "/"))

If Request("imageCancel") <> "" Then
    Session("StoredFile") = ""
    Session("strImage")   = ""
End If
%>
<html>
<head>
<title>Corp2Net.com</title>
<script language="JavaScript" src="/admin.js"></script>
<script language="JavaScript">
<!--
function UpLoad(obj)
{
    if (obj.my_file.value.length < 7)
            return false;
    return true;
}
// -->
</script>
<body link=<%= COLOR_NL_1 %> alink=<%= COLOR_AL_1 %> vlink=<%= COLOR_VL_1 %> bgcolor=<%= COLOR_BG_1 %>>
<font color="<%= C_WD_CONTENT_4 %>">
Only upload <b>*.jpg</b> or <b>*.gif</b> file!
<br>
Otherwise, image may not show correctly!
</font>
<center>
<table>
<% If ( Len(Session("strImage")) > 0 ) Then %>
<tr>
    <td>
        <table border="1" bordercolor="<%= C_WD_T_BORDER %>" cellspacing="0" cellpadding="0" <%= IMAGE_SIZE %>>
        <tr>
            <td><%= Session("strImage") %></td>
        </tr>
        </table>
    </td>
</tr>
<% Else %>
<tr>
    <td>
     &n

时间: 2024-11-05 18:36:14

不用组件实现上载功能(英文NT)2.的相关文章

不用组件实现上载功能(英文NT)

'---- file name /upaoad.asp/ <%Public Function BuildUploadRequest(strRequestBin)Dim PosBeg, PosEnd, boundary, boundaryPos'Get the boundaryPosBeg = 1PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(13)))boundary = MidB(strRequestBin,PosBeg,PosEn

不用组件实现上载功能(1)

---- file name /upaoad.asp/ <%Public Function BuildUploadRequest(strRequestBin)    Dim PosBeg, PosEnd, boundary, boundaryPos    'Get the boundary    PosBeg = 1    PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(13)))    boundary = MidB(strRequ

不用组件实现上载功能(2)

'---- file name /handld_upload.asp <% Option Explicit %> <%Response.Expires=0Response.Buffer = TRUEResponse.ClearConst IMAGE_SIZE = "width=""200"" height=""150"""Dim UploadRequestSet UploadRequest

不用组件如何控制.flv音量大小

控制 好些网友PM我问:"要是不用组件怎么控制.flv 的音量呢?"其实都很简单的,跟控制MP3音量都是一箩子的事-//:::::*****夏日之夜(Guoyl)*****::::: // :::::*****QQ:190603050*****::::: var nc:NetConnection = new NetConnection(); nc.connect(null); var ns:NetStream = new NetStream(nc); myVideo.attachVid

ftp-IIS FTP 保留部分上载功能,传输意外停止后,文件约6、7分钟不可访问

问题描述 IIS FTP 保留部分上载功能,传输意外停止后,文件约6.7分钟不可访问 1C 我自己编写Ftp客户端(采用.NET框架提供的FtpWebRequest接口),服务器采用IIS提供的Ftp服务器.为了支持断点续传功能,我开启了IIS服务器上"保留部分上载"的配置选项,正常的"暂停"和"继续"操作都可以实现断点续传.但是,若网络出现异常,传输意外中断,则IIS的Ftp服务器上该文件会在短时间内变得不可用(约6~7分钟),这段时间内,不管

以前收集的一些资料---不用组件上载文件代码段(三)

文件fformat.inc<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT> function Foot()  DIM HTML    HTML = "<hr><Table Border=0 Width=100%><TR><TD><font size=1>燬ample upload/download via ASP from <a href=http://www.pstruh.cz>P

以前收集的一些资料---不用组件上载文件代码(二)

文件futils.inc<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>'True PureASP upload - enables save of uploaded text fields to the disk.'c1997-1999 Antonin Foller, PSTRUH Software, http://www.pstruh.cz'The file is part of ScriptUtilities library'The file enables

以前收集的一些资料---不用组件上载文件代码具体例子

下面的第一个例子为只是将客户端的文件上传到服务端的例子第二个例子为将文件内容保存入数据库中.文件fupload.asp<%dim ResultHTML'Some value greater than default of 60s (According to upload size.)'The maximum speed is about 100kB/s for IIS4, P200 and local upload, 4kB/s for modem users.Server.ScriptTime

在英文NT及SQL下,实现页面中中文出现

页面|中文 问题:从数据库中读出的中文均为"?" 解决方案: Step 1:注册 Code Page使SQL Server支持中文 1.复制文件C_936.nls到系统目录下的system32目录 2.使用Regedit32.exe增加以下键: location: HKEY_LOCAL_MACHINEsystemCurrentControlSetControlNlsCodePage value name: 936 value: C_936.NLS location: HKEY_LOCA