不用组件实现上载功能(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>
        <table border="1" bordercolor="<%= C_WD_T_BORDER %>" cellspacing="0" cellpadding="0">
        <tr>
            <td align="center" valign="top">
                <table cellspacing="0" cellpadding="0" border="0" <%= IMAGE_SIZE %>>
                <tr>
                    <td colspan="2"><font class="e-foot" color="<%= C_WD_CONTENT_4 %>"><b>Upload / preview image:</b></font></td>
                </tr>
                <tr>
                    <td colspan="2"> </td>
                </tr>
                <tr>
                    <td valign="top" nowrap><font class="e-foot" color="<%= C_WD_CONTENT_4 %>"><b>Step 1:</b></font></td>
                    <td valign="top"><font class="e-foot" color="<%= C_WD_CONTENT_4 %>">Prepare an image with 72 dpi resolution.</font></td>
                </tr>
                <tr>
                    <td valign="top"><font class="e-foot" color="<%= C_WD_CONTENT_4 %>"><b>Step 2:</b></font></td>
                    <td valign="top"><font class="e-foot" color="<%= C_WD_CONTENT_4 %>">Select your image file</font></td>
                </tr>
                <tr>
                    <td valign="top"><font class="e-foot" color="<%= C_WD_CONTENT_4 %>"><b>Step 3:</b></font></td>
                    <td valign="top"><font class="e-foot" color="<%= C_WD_CONTENT_4 %>">Press "Upload" button</font></td>
                </tr>
                <tr>
                    <td valign="top"><font class="e-foot" color="<%= C_WD_CONTENT_4 %>"><b>Step 4:</b></font></td>
                    <td valign="top"><font class="e-foot" color="<%= C_WD_CONTENT_4 %>">Continue <b>OR</b> repeat <b>Step 1-3</b> to change the image</font></td>
                </tr>
                </table>
            </td>
        </tr>
        </table>
    </td>
</tr>
<% End If %>
</table>
</center>

<form method="POST" enctype="multipart/form-data" action="handle_upload.asp" id=form1 name=form1>
    <input type="hidden" name="saveURL" value="<%= WEB_TEMP_PATH %>">
    <input type="hidden" name="goURL" value="<%= Request.ServerVariables("PATH_INFO") %>">
    <input class="btn" type="file" name="my_file">
    <input class="btn" type="submit" name="submit" value="Upload" >
</form>

<form action="<%= thisFile %>" id=form2 name=form2>
<input class="btn" type="submit" name="imageCancel" value="Press Here To Cancel Image!">
<br> <br>
<input class="btn" type="submit" value="Finish!" id=submit1 name=submit1>
</form>
</body>
</html>

时间: 2024-11-03 03:39:10

不用组件实现上载功能(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

不用组件实现上载功能(英文NT)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

Swift多列表格组件的基本功能的例子

与桌面.Web应用不同,受限于屏幕尺寸,移动APP常常采用单列表格来显示列表数据.但有时我们需要使用多列表格来展示数据(比如:报表数据显示,或iPad这种大屏设备上展示多栏数据),这些通过网格(UICollectionView)的自定义布局功能就可以实现.   1,多列表格(multi-column table control)效果图 2,功能说明: (1)表格列头的标题文字加粗,内容区域的文字正常 (2)表格边框为1像素黑色边框 (3)第一列文字居左,其余列文字居中显示(居左的文字离左侧还是有