Process a md5 on the uploaded file, and display it in the per file view.

- The uploader can check that the uploaded file is correct
- The downloader can check his download too
This commit is contained in:
William MARTIN
2011-05-31 13:58:12 +02:00
parent b9407f6aee
commit 95cc7f627f
3 changed files with 64 additions and 0 deletions

View File

@@ -77,6 +77,12 @@ class IDF_Upload extends Pluf_Model
'default' => 0,
'verbose' => __('file size in bytes'),
),
'md5' =>
array(
'type' => 'Pluf_DB_Field_Text',
'blank' => true,
'verbose' => __('MD5'),
),
'submitter' =>
array(
'type' => 'Pluf_DB_Field_Foreignkey',
@@ -144,6 +150,7 @@ class IDF_Upload extends Pluf_Model
if ($this->id == '') {
$this->creation_dtime = gmdate('Y-m-d H:i:s');
$this->modif_dtime = gmdate('Y-m-d H:i:s');
$this->md5 = md5_file (Pluf::f('upload_path') . '/' . $this->get_project()->shortname . '/files/' . $this->file);
}
}