CVS update: php3/doc/chapters
| From: | rasmus | Date: | Sat, 15 May 1999 21:11:04 +0000 |
| Subject: | CVS update: php3/doc/chapters | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5647@lists.php.net to get a copy of this message | ||
Date: Saturday May 15, 1999 @ 17:11
Author: rasmus
Update of /repository/php3/doc/chapters
In directory php:/tmp/cvs-serv23927/doc/chapters
Modified Files:
features.sgml
Log Message:
Clean up, test and document the PUT method support code
Index: php3/doc/chapters/features.sgml
diff -u php3/doc/chapters/features.sgml:1.24 php3/doc/chapters/features.sgml:1.25
--- php3/doc/chapters/features.sgml:1.24 Sat May 8 23:09:52 1999
+++ php3/doc/chapters/features.sgml Sat May 15 17:11:03 1999
@@ -127,6 +127,13 @@
what is to be done with the file once it has been uploaded.
</simpara>
<para>
+ Note that PHP also support PUT-method file uploads as used by
+ Netscape Composer and W3C's Amaya clients. See the
+ <link linkend="feature-putsupport">PUT Method Support</link> for more
+ details.
+ </para>
+
+ <para>
A file upload screen can be built by creating a special form which
looks something like this:
@@ -210,6 +217,58 @@
it gets from the client. As long as this is the case, CERN httpd
will not support the file upload feature.
+
+ <sect1 id="feature-putsupport">
+ <title>PUT Method Support</title>
+ <simpara>
+ PHP provides support for the HTTP PUT method used by clients such as
+ Netscape Composer and W3C Amaya. PUT requests are much
+ simpler than a file upload and they look something like this:
+ </simpara>
+ <simpara>
+ <emphasis>PUT /path/filename.html HTTP/1.1</emphasis>
+ </simpara>
+ <simpara>
+ This would normally mean that the remote client would like to save
+ the content that follows as: /path/filename.html in your web tree.
+ It is obviously not a good idea for Apache or PHP to automatically
+ let everybody overwrite any files in your web tree. So, to handle
+ such a request you have to first tell your web server that you want
+ a certain PHP script to handle the request. In Apache you do this
+ with the <emphasis>Script</emphasis> directive. It can be placed
+ almost anywhere in your Apache configuration file. A common place
+ is inside a <Directory> block or perhaps inside a <Virtualhost>
+ block. A line like this would do the trick:
+ </simpara>
+ <simpara>
+ <emphasis>Script PUT /put.php3</emphasis>
+ </simpara>
+ <simpara>
+ This tells Apache to send all PUT requests for URIs that match the
+ context in which you put this line to the put.php3 script. This assumes,
+ of course, that you have PHP enabled for the .php3 extension and PHP is
+ active.
+ </simpara>
+ <simpara>
+ Inside your put.php3 file you would then do something like this:
+ </simpara>
+ <simpara>
+ <? copy($PHP_UPLOADED_FILE_NAME,$DOCUMENT_ROOT.$REQUEST_URI); ?>
+ </simpara>
+ <simpara>
+ This would copy the file to the location requested by the remote client.
+ You would probably want to perform some checks and/or authenticate the
+ user before performing this file copy. The only trick here is that when
+ PHP sees a PUT-method request it stores the uploaded file in a temporary
+ file just like the <link linkend="feature-fileupload">File Upload</link>
+ feature. When the request ends, this temporary file is deleted. So, your
+ PUT handling PHP script has to copy that file somewhere. The filename of
+ this temporary file is in the $PHP_PUT_FILENAME variable, and you can see
+ the suggested destination filename in the $REQUEST_URI (may vary on non-Apache
+ web servers). This destination filename is the one that the remote client
+ specified. You do not have to listen to this client. You could, for example,
+ copy all uploaded files to a special uploads directory.
+ </simpara>
<sect1 id="feature-cookies">
<title>HTTP cookie support</title>
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net