goba            Sun Aug 19 09:20:43 2001 EDT

  Modified files:              
    /phpdoc/en/features file-upload.xml 
  Log:
   . The best place to show how <![CDATA[ ... ]]> can help...
   . Converting all HTML tags to lowecased ones
   . Using correct <filename> instead of other bad ones
   . Adding role="html" to HTML example
  
  
  
Index: phpdoc/en/features/file-upload.xml
diff -u phpdoc/en/features/file-upload.xml:1.23 phpdoc/en/features/file-upload.xml:1.24
--- phpdoc/en/features/file-upload.xml:1.23     Sun Aug 19 07:09:16 2001
+++ phpdoc/en/features/file-upload.xml  Sun Aug 19 09:20:42 2001
@@ -1,5 +1,5 @@
 <?xml encoding="iso-8859-1"?>
-<!-- $Revision: 1.23 $ -->
+<!-- $Revision: 1.24 $ -->
  <chapter id="features.file-upload">
   <title>Handling file uploads</title>
 
@@ -26,12 +26,14 @@
     looks something like this:
     <example>
      <title>File Upload Form</title>
-     <programlisting>
-&lt;FORM ENCTYPE=&quot;multipart/form-data&quot; ACTION=&quot;_URL_&quot; 
METHOD=&quot;POST&quot;&gt;
-&lt;INPUT TYPE=&quot;hidden&quot; name=&quot;MAX_FILE_SIZE&quot; 
value=&quot;1000&quot;&gt;
-Send this file: &lt;INPUT NAME=&quot;userfile&quot; TYPE=&quot;file&quot;&gt;
-&lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;Send File&quot;&gt;
-&lt;/FORM&gt;
+     <programlisting role="html">
+<![CDATA[
+<form enctype="multipart/form-data" action="_URL_" method="post">
+<input type="hidden" name="MAX_FILE_SIZE" value="1000">
+Send this file: <input name="userfile" type="file">
+<input type="submit" value="Send File">
+</form>
+]]>
      </programlisting>
     </example>
     The _URL_ should point to a PHP file.  The MAX_FILE_SIZE hidden
@@ -81,14 +83,14 @@
       <simpara>
        <varname>$userfile_type</varname> - The mime type of the file
        if the browser provided this information.  An example would be
-       &quot;image/gif&quot;.
+       "image/gif".
       </simpara>
      </listitem>
     </itemizedlist>
-    Note that the &quot;$userfile&quot; part of the above variables is
+    Note that the "$userfile" part of the above variables is
     whatever the name of the INPUT field of TYPE=file is in the upload
     form.  In the above upload form example, we chose to call it
-    &quot;userfile&quot;
+    "userfile"
    </para>
 
    <para>
@@ -119,7 +121,7 @@
        <para>
         The mime type of the file, if the browser provided this
         information.  An example would be
-        <literal>&quot;image/gif&quot;</literal>.
+        <literal>"image/gif"</literal>.
         </para>
       </listitem>
      </varlistentry>
@@ -163,7 +165,8 @@
       <function>move_uploaded_file</function>.
      </para>
      <programlisting role="php">
-&lt;?php 
+<![CDATA[
+<?php 
 if (is_uploaded_file($userfile)) {
     copy($userfile, "/place/to/put/uploaded/file");
 } else {
@@ -171,7 +174,8 @@
 }
 /* ...or... */
 move_uploaded_file($userfile, "/place/to/put/uploaded/file");
-?&gt;
+?>
+]]>
      </programlisting>
      <para>
       For earlier versions of PHP, you'll need to do something like
@@ -185,7 +189,8 @@
       </note>
      </para>
      <programlisting role="php">
-&lt;?php 
+<![CDATA[
+<?php
 /* Userland test for uploaded file. */ 
 function is_uploaded_file($filename) {
     if (!$tmp_file = get_cfg_var('upload_tmp_dir')) {
@@ -202,6 +207,7 @@
     echo "Possible file upload attack: filename '$userfile'.";
 }
 ?>
+]]>
      </programlisting>
     </example>
    </para>
@@ -226,8 +232,7 @@
    <title>Common Pitfalls</title>
    <simpara>
     The <literal>MAX_FILE_SIZE</literal> item cannot specify a file size 
-       greater than the file 
-    size that has been set in the <link
+    greater than the file size that has been set in the <link
     linkend="ini.upload-max-filesize">upload_max_filesize</link> ini-setting.
     The default is 2 Megabytes.
    </simpara>
@@ -260,12 +265,14 @@
     <example>
      <title>Uploading multiple files</title>
      <programlisting role="html">
-&lt;form action=&quot;file-upload.php&quot; method=&quot;post&quot; 
enctype=&quot;multipart/form-data&quot;&gt;
-  Send these files:&lt;br&gt;
-  &lt;input name=&quot;userfile[]&quot; type=&quot;file&quot;&gt;&lt;br&gt;
-  &lt;input name=&quot;userfile[]&quot; type=&quot;file&quot;&gt;&lt;br&gt;
-  &lt;input type=&quot;submit&quot; value=&quot;Send files&quot;&gt;
-&lt;/form&gt;
+<![CDATA[
+<form action="file-upload.php" method="post" enctype="multipart/form-data">
+  Send these files:<br>
+  <input name="userfile[]" type="file"><br>
+  <input name="userfile[]" type="file"><br>
+  <input type="submit" value="Send files">
+</form>
+]]>
      </programlisting>
     </example>
    </para>
@@ -283,10 +290,10 @@
     <filename>/home/test/review.html</filename> and
     <filename>/home/test/xwp.out</filename> are submitted.  In this
     case, <varname>$userfile_name[0]</varname> would
-    contain the value <literal>review.html</literal>,
+    contain the value <filename>review.html</filename>,
     and <varname>$userfile_name[1]</varname> would
     contain the value
-    <varname>xwp.out</varname>. Similarly,
+    <filename>xwp.out</filename>. Similarly,
     <varname>$userfile_size[0]</varname> would contain
     <filename>review.html</filename>'s filesize, and so forth.
    </simpara>
@@ -339,7 +346,9 @@
    </simpara>
    <para>
     <informalexample><programlisting>
-&lt;?php copy($PHP_UPLOADED_FILE_NAME,$DOCUMENT_ROOT.$REQUEST_URI); ?&gt;
+<![CDATA[
+<?php copy($PHP_UPLOADED_FILE_NAME,$DOCUMENT_ROOT.$REQUEST_URI); ?>
+]]>
     </programlisting></informalexample>
    </para>
    <simpara>


Reply via email to