From 78cf0c1c856a78238694e95569eb4e91f920d235 Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Tue, 5 Aug 2008 21:01:06 +0200 Subject: [PATCH] Fixed to push the overwrite check at the framework level. --- src/IDF/Form/Upload.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/IDF/Form/Upload.php b/src/IDF/Form/Upload.php index a88c2c3..f308142 100644 --- a/src/IDF/Form/Upload.php +++ b/src/IDF/Form/Upload.php @@ -49,7 +49,8 @@ class IDF_Form_Upload extends Pluf_Form 'label' => __('File'), 'initial' => '', 'move_function_params' => array('upload_path' => Pluf::f('upload_path').'/'.$this->project->shortname.'/files', - 'upload_path_create' => true), + 'upload_path_create' => true, + 'upload_overwrite' => false), )); for ($i=1;$i<7;$i++) { @@ -70,9 +71,6 @@ class IDF_Form_Upload extends Pluf_Form if (!preg_match('/\.(png|jpg|jpeg|gif|bmp|psd|tif|aiff|asf|avi|bz2|css|doc|eps|gz|mdtext|mid|mov|mp3|mpg|ogg|pdf|ppt|ps|qt|ra|ram|rm|rtf|sdd|sdw|sit|sxi|sxw|swf|tgz|txt|wav|xls|xml|wmv|zip)$/i', $this->cleaned_data['file'])) { throw new Pluf_Form_Invalid(__('For security reason, you cannot upload a file with this extension.')); } - if (file_exists(Pluf::f('upload_path').'/'.$this->project->shortname.'/files/'.$this->cleaned_data['file'])) { - throw new Pluf_Form_Invalid(sprintf(__('A file with the name "%s" is already available for download.'), $this->cleaned_data['file'])); - } return $this->cleaned_data['file']; }