techtonik               Mon Feb 14 11:20:01 2005 EDT

  Modified files:              
    /phpdoc/en/reference/filesystem/functions   is-uploaded-file.xml 
  Log:
  integrated note 39637, added example
  please check wording
  
http://cvs.php.net/diff.php/phpdoc/en/reference/filesystem/functions/is-uploaded-file.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/filesystem/functions/is-uploaded-file.xml
diff -u phpdoc/en/reference/filesystem/functions/is-uploaded-file.xml:1.5 
phpdoc/en/reference/filesystem/functions/is-uploaded-file.xml:1.6
--- phpdoc/en/reference/filesystem/functions/is-uploaded-file.xml:1.5   Tue May 
18 10:23:19 2004
+++ phpdoc/en/reference/filesystem/functions/is-uploaded-file.xml       Mon Feb 
14 11:20:00 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
 <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.39 -->
   <refentry id="function.is-uploaded-file">
    <refnamediv>
@@ -26,6 +26,29 @@
      system.
     </para>
     <para>
+     For proper working, the function <function>is_uploaded_file</function> 
needs
+     an argument like $_FILES['userfile']['tmp_name'], - the name of the 
uploaded
+     file on the clients machine $_FILES['userfile']['name'] does not work.
+    </para>
+    <example>
+     <title><function>is_uploaded_file</function> example</title>
+     <programlisting role="php">
+<![CDATA[
+<?php
+
+if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
+   echo "File ". $_FILES['userfile']['name'] ." uploaded successfully.\n";
+   echo "Displaying contents\n";
+   readfile($_FILES['userfile']['tmp_name']);
+} else {
+   echo "Possible file upload attack: ";
+   echo "filename '". $_FILES['userfile']['tmp_name'] . "'.";
+}
+
+?>]]>
+     </programlisting>
+    </example>
+    <para>
      <function>is_uploaded_file</function> is available only in
      versions of PHP 3 after PHP 3.0.16, and in versions of PHP 4
      after 4.0.2. If you are stuck using an earlier version, you can
@@ -39,7 +62,7 @@
      </note>
     </para>
      <example>
-      <title><function>is_uploaded_file</function> example</title>
+      <title><function>is_uploaded_file</function> example for PHP 4 &lt; 
4.0.3</title>
      <programlisting role="php">
 <![CDATA[
 <?php

Reply via email to