svn: /phpdoc/en/trunk/reference/mongo/mongogridfs/ storeupload.xml

From: Date: Wed, 24 Aug 2011 18:48:02 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/mongogridfs/ storeupload.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-8670@lists.php.net to get a copy of this message
kristina Wed, 24 Aug 2011 18:48:02 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=315446 Log: Changed second option to storeUpload Changed paths: U phpdoc/en/trunk/reference/mongo/mongogridfs/storeupload.xml Modified: phpdoc/en/trunk/reference/mongo/mongogridfs/storeupload.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongogridfs/storeupload.xml 2011-08-24 18:31:48 UTC (rev 315445) +++ phpdoc/en/trunk/reference/mongo/mongogridfs/storeupload.xml 2011-08-24 18:48:02 UTC (rev 315446) @@ -12,8 +12,35 @@ <methodsynopsis> <modifier>public</modifier> <type>mixed</type><methodname>MongoGridFS::storeUpload</methodname> <methodparam><type>string</type><parameter>name</parameter></methodparam> - <methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>metadata</parameter></methodparam> </methodsynopsis> + <para> + Stores files directly from a POST to the database. For example, suppose you + had the following HTML form: + </para> + <programlisting role="php"> +<![CDATA[ +<form method="POST" enctype="multipart/form-data"> + Please upload a profile picture: <input type="file" name="pic"/> + <input type="submit"/> +</form> +]]> + </programlisting> + <para> + If you wanted to store this upload in MongoDB, you could do: + </para> + <programlisting role="php"> +<![CDATA[ +<?php + +$grid->storeUpload("pic", array("username" => "joe")); + +?> +]]> + </programlisting> + <para> + Note that the "name" field in HTML matches the name parameter. + </para> </refsect1> <refsect1 role="parameters"> @@ -29,17 +56,17 @@ The name field of the uploaded file. </para> </listitem> - </varlistentry> + </varlistentry> <varlistentry> <term> - <parameter>filename</parameter> + <parameter>metadata</parameter> </term> <listitem> <para> - String to be used as filename field in the database. + An array of extra fields for the uploaded file. </para> </listitem> - </varlistentry> + </varlistentry> </variablelist> </para> </refsect1> @@ -50,6 +77,32 @@ Returns the _id of the uploaded file. </para> </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>1.2.5</entry> + <entry> + Changed second parameter to an array of metadata. Pre-1.2.5, the + second parameter was an optional string overriding the filename. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file Local variables: @@ -69,4 +122,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 ---> +-->

« previous php.doc.cvs (#8670) next »