当前位置:

Netease BBS 精华 >>讨论区精华 >>电脑技术 >>● ASP >>ASP典型范例

发信人: veryhard.bbs@bj.netease.com (飞鸟), 信区: ASP
标  题: Re: 如何用ASP做上载文件
发信站: 飞鸟 (Tue Mar  2 15:03:19 1999)
转信站: Netease!Netease2

upldsmpl.asp 文件上传实例
----------------------------------------------------------------------
------
<% Response.Buffer = TRUE %>

<!-- 
This sample script uses the Microsoft Posting Acceptor to 
handle file uploads.
Leon Braginski & Matt Powell (c)
-->

<% if (Len(Request.ServerVariables("LOGON_USER")) = 0 ) then %>
<% Response.Status = "401 Unauthorized" %>
<HTML><BODY><B>Error: Access is denied.</B><P></BODY></HTML>
<% else %>
<html>
<body>
<center><h2>File Upload</h2></center>

<form enctype="multipart/form-data" 
action="http://<%= Request.ServerVariables("SERVER_NAME")%>/scripts/cp
shost.dll?PUBLISH" 
method=POST>
File to process: <input name="my_file" type="file"><br>
Destination URL: <input name="TargetURL"><br>
<input type="submit" value="Upload">
</form>

</body>
</html>
<% end if %>

-------------------------------------------------------------------
A Simple File Upload Code Sample
-------------------------------------------------------------------
The Chap08 directory contains a code sample to perform simple file
uploads. The sample is an ASP page that uses the Posting Acceptor
ISAPI extension (CPSHOST.DLL).


Testing the simple file upload sample
=====================================
1.  Be sure that you have the Posting Acceptor installed.
        C:\Inetpub\scripts\cpshost.dll
    The Posting Acceptor is a subcomponent of the Microsoft Site
    Server Express 2.0 component in the Windows NT 4.0 Option Pack.
2.  Open UPLDSMPL.ASP in Internet Explorer to test.
        http://<computername>/RunningIIS/Chap08/upldsmpl.asp
3.  Upload a file to a directory that has Write permissions.


Allowing Anonymous Users
========================
To allow the Posting Acceptor to accept files from anonymous users,
add a setting in the registry:
    Key:  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Webpost\Acceptors\CPSH
ost
    REG_DWORD Value Name:  AllowAnonymous
    Data:  1


Configuration
=============
The simple file upload sample was tested with the following
configuration:
Microsoft Windows NT Server 4.0 SP3
Microsoft Internet Information Server 4.0
Microsoft Internet Explorer 4.01




--
飞鸟,来自
http://flybird-home.yeah.net
http://joyasp.yeah.net

※ 来源:.网易虚拟社区北京站 http://bj.netease.com.[FROM: 203.207.143.210]


当前位置:

Netease BBS 精华 >>讨论区精华 >>电脑技术 >>● ASP >>ASP典型范例
 
(C)1997-1998 版权所有
广州网易计算机系统有限公司