荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: tang (独孤九剑〖玄铁重剑〗), 信区: Homepage
标  题: [转载] ASP的文件上传实现方法
发信站: BBS 荔园晨风站 (Sun Apr 11 20:58:52 1999), 站内信件

【 以下文字转载自 Program 讨论区 】
【 原文由 zzt 所发表 】
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


--



日出东方,唯我不败;
    天上地下,唯我独尊。

※ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.0.72]
--
※ 转载:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.0.4]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店