Permalink
Browse files

Fix to issue #6 (Allow not uploading any file) and issue #9 (bug if e…

…mpty file field). Thanks to joelpet.
  • Loading branch information...
1 parent a5e3a84 commit 204c4f7d6a096c5091ac671148396060149124ca Juan Basso committed Aug 27, 2009
Showing with 5 additions and 1 deletion.
  1. +5 −1 models/behaviors/meio_upload.php
@@ -631,6 +631,10 @@ function _uploadFile($model, $data = null) {
$data =& $model->data;
}
foreach ($this->__fields as $fieldName => $options) {
+ if (empty($data[$model->alias][$fieldName]['name'])) {
+ unset($data[$model->alias][$fieldName]);
+ return array('return' => true, 'data' => $data);
+ }
$pos = strrpos($data[$model->alias][$fieldName]['type'], '/');
$sub = substr($data[$model->alias][$fieldName]['type'], $pos+1);
@@ -1138,4 +1142,4 @@ function _addError($msg) {
$this->errors[] = $msg;
}
}
-?>
+?>

0 comments on commit 204c4f7

Please sign in to comment.