Fixed to have correct post failure cleaning of the uploaded file.

Note: Latest Pluf release needed.
This commit is contained in:
Loic d'Anterroches 2008-11-27 09:48:01 +01:00
parent 93c44feb05
commit eb60e99d5c

View File

@ -109,6 +109,18 @@ class IDF_Form_Upload extends Pluf_Form
return $this->cleaned_data;
}
/**
* If we have uploaded a file, but the form failed remove it.
*
*/
function failed()
{
if (!empty($this->cleaned_data['file'])
and file_exists(Pluf::f('upload_path').'/'.$this->project->shortname.'/files/'.$this->cleaned_data['file'])) {
@unlink(Pluf::f('upload_path').'/'.$this->project->shortname.'/files/'.$this->cleaned_data['file']);
}
}
/**
* Save the model in the database.
*