-
Go to “Control Panel » System configuration » Metadata » Fieldsets » Create new”
-
Set the “Fieldset name” (Something like “Info”, it doesn't really matter)
-
Tick the “Generic fieldset” checkbox. (So that all files show this fieldset)
-
Click “Save” to add the fieldset.
-
Click “Manage Fields > Create new”
-
Type “Checksum” for the “Field name” and click “Save”
-
By holding the mouse cursor over the newly created field name you can find out its ID, from the link's URL (……&fid=X)
-
Create the text file “customizables/events/upload.php” and paste the following code inside:
```
unserialize($data['data']);
$metaFileInfo = \WebFileShare\MetaFiles::getByPath("*", $data['full_path']);//get file metadata record
if (!$metaFileInfo['id']) {
$id = \WebFileShare\MetaFiles::addFile($data['full_path']);//add file metadata record if not found
if ($id) {
$metaFileInfo['path'] = $data['full_path'];
$metaFileInfo['id'] = $id;
}
}
$hash =
md5(
file_get_contents($data['full_path']));
\WebFileShare\MetaValues::set($metaFileInfo['id'], $fieldId, $hash);//set hash as metadata
```