Index: forms_api_reference.html
===================================================================
RCS file: /cvs/drupal-contrib/contributions/docs/developer/topics/forms_api_reference.html,v
retrieving revision 1.137
diff -u -r1.137 forms_api_reference.html
--- forms_api_reference.html	22 Jul 2010 23:41:35 -0000	1.137
+++ forms_api_reference.html	13 Oct 2010 23:22:09 -0000
@@ -1718,7 +1718,16 @@
 
 <p>The #managed_file element is expanded into a set of FAPI elements including two '#submit' buttons one for Upload one for Remove, a '#file' element and a handful of '#hidden' and '#markup' elements to handle progress indication and displaying of already uploaded files.</p>
 
-<p><strong>Note:</strong> New files are uploaded with a status of 0 and are treated as temporary files which are removed after 6 hours via cron. Your module is responsible for changing the $file objects status to FILE_STATUS_PERMANENT and saving the new status to the database. Something like the following within your submit handler should do the trick.</p>
+<p><strong>Note:</strong> New files are uploaded with a status of 0 and are treated as temporary files which are removed after 6 hours via cron. Your module is responsible for changing the $file objects status to FILE_STATUS_PERMANENT and saving the new status to the database. Something like the following within your submit handler should do the trick.
+<div class="codeblock"><code><span class="def-txt">
+  // Load the file via file.fid.<br />
+  <span class="b-txt">$file = file_load</span><span class="g-txt">(</span><span class="b-txt">$form_state</span><span class="g-txt">[</span><span class="r-txt">&#x27;values&#x27;</span><span class="g-txt">][</span><span class="r-txt">&#x27;my_file_field&#x27;</span><span class="g-txt">]);</span><br />
+  // Change status to permanent.<br />
+  <span class="b-txt">$file</span><span class="g-txt">-&gt;</span><span class="b-txt">status</span> <span class="b-txt">= FILE_STATUS_PERMANENT</span><span class="g-txt">;</span><br />
+  // Save.<br />
+  <span class="b-txt">file_save</span><span class="g-txt">(</span><span class="b-txt">$file</span><span class="g-txt">);</span><br />
+  </span></code></div>
+</p>
 
 <p>Once a file has been uploaded the file object's fid can be used as the #default_value for the form element. This will display an icon, a link to the file, and a remove button.</p>
 
@@ -1731,7 +1740,21 @@
 <li>#upload_validators: (array) an array of callback functions to perform validation of uploaded files.</li>
 <li>#upload_location (string) location on server where uploaded files should be stored. e.g.) 'public://files/my_files_director'</li>
 </ul>
-The image_example module provides a good example of basic usage in <a href="http://api.drupal.org/api/drupal/developer--examples--image_example--image_example.pages.inc/7/source">image_example.pages.inc</a>.
+
+<p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, 
+<a href="#array_parents">#array_parents</a>, <a href="#attached">#attached</a>, 
+<a href="#attributes">#attributes</a>, <a href="#description">#description</a>, 
+<a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, 
+<a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, 
+<a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>,
+<a href="#process">#process</a>, <a href="#states">#states</a>, 
+<a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, 
+<a href="#theme_wrappers">#theme_wrappers</a>, <a href="#title">#title</a>, 
+<a href="#tree">#tree</a>, <a href="#weight">#weight</a></p>
+
+<p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/drupal/developer--examples--image_example--image_example.pages.inc/7/source">image_example.pages.inc</a>.):</p>
+
+<div class="codeblock"><code><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);">&lt;?php<br></span><span style="color: rgb(255, 128, 0);">// Use the #managed_file FAPI element to upload an image file.<br></span><span style="color: rgb(0, 0, 187);">$form</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'image_example_image_fid'</span><span style="color: rgb(0, 119, 0);">] = array(<br>&nbsp; </span><span style="color: rgb(221, 0, 0);">'#title' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">t</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Image'</span><span style="color: rgb(0, 119, 0);">),<br>&nbsp; </span><span style="color: rgb(221, 0, 0);">'#type' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(221, 0, 0);">'managed_file'</span><span style="color: rgb(0, 119, 0);">,<br>&nbsp; </span><span style="color: rgb(221, 0, 0);">'#description' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">t</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'The uploaded image will be displayed on this page using the image style choosen below.'</span><span style="color: rgb(0, 119, 0);">),<br>&nbsp; </span><span style="color: rgb(221, 0, 0);">'#default_value' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">variable_get</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'image_example_image_fid'</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(221, 0, 0);">''</span><span style="color: rgb(0, 119, 0);">),<br>&nbsp; </span><span style="color: rgb(221, 0, 0);">'#upload_location' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(221, 0, 0);">'public://image_example_images/'</span><span style="color: rgb(0, 119, 0);">,<br>);<br></span><span style="color: rgb(0, 0, 187);">?&gt;</span></span></code></div>
 
 <!-- End managed_file -->
 
