VB 版 (精华区)
发信人: folmorse (◆金瓶楼主◆), 信区: VB
标 题: ASP实例
发信站: 大红花的国度 (Sun Jun 11 15:02:31 2000), 转信
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
※ 修改:.folmorse 于 Jun 11 15:01:27 修改本文.[FROM: hpwei.hit.edu.cn]
--
※ 转寄:.华南网木棉站 bbs.gznet.edu.cn.[FROM: hpwei.hit.edu.cn]
--
☆ 来源:.哈工大紫丁香 bbs.hit.edu.cn.[FROM: folmorse.bbs@melon.g]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.356毫秒