精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● ASP>>文件上传>>ASP的文件上传实现方法

主题:ASP的文件上传实现方法
发信人: [email protected]()
整理人: qcrsoft(2002-05-13 16:33:05), 站内信件

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>Error: Access is denied.<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]

[关闭][返回]