Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.219
diff -u -r1.219 file.inc
--- includes/file.inc	26 Jul 2010 03:04:29 -0000	1.219
+++ includes/file.inc	31 Jul 2010 22:41:09 -0000
@@ -1784,9 +1784,15 @@
   static $max_size = -1;
 
   if ($max_size < 0) {
+    // Start with post_max_size.
+    $max_size = parse_size(ini_get('post_max_size'));
+
+    // If upload_max_size is less, then reduce. Except if upload_max_size is
+    // zero, which indicates no limit.
     $upload_max = parse_size(ini_get('upload_max_filesize'));
-    $post_max = parse_size(ini_get('post_max_size'));
-    $max_size = ($upload_max < $post_max) ? $upload_max : $post_max;
+    if ($upload_max > 0 && $upload_max < $max_size) {
+      $max_size = $upload_max;
+    }
   }
   return $max_size;
 }
