diff --git a/framework/yii/helpers/HtmlBase.php b/framework/yii/helpers/HtmlBase.php
index cfff8f5..a93c93e 100644
--- a/framework/yii/helpers/HtmlBase.php
+++ b/framework/yii/helpers/HtmlBase.php
@@ -1049,7 +1049,10 @@ class HtmlBase
*/
public static function activeFileInput($model, $attribute, $options = array())
{
- return static::activeInput('file', $model, $attribute, $options);
+ // add a hidden field so that if a model only has a file field, we can
+ // still use isset($_POST[$modelClass]) to detect if the input is submitted
+ return static::activeHiddenInput($model, $attribute, array('id' => null, 'value' => ''))
+ . static::activeInput('file', $model, $attribute, $options);
}
/**