Reputation: 1285
I want to import some files in Typo3 system using external php Script. How do I create hash field value like identifier_hash
folder_hash
sha1
for sys_file table?
If I leave these fields empty there is error:
Attempt to modify record '3094' (sys_file_reference:3094) without permission. Or non-existing page.
Upvotes: 1
Views: 1801
Reputation: 11
$file = array(
'folder' => 'images',
'identifier' => 'images/foobar.jpg'
);
$identifierHash = sha1($file['identifier']);
$folderHash = sha1($file['folder']);
$sha1 = sha1_file($file['identifier']);
Upvotes: 1
Reputation: 1024
Probably the best way to do this is to call TYPO3 API, therefore you have to place somewhere in fileadmin/ and then call
TYPO3\CMS\Core\Resource\getFileObjectByStorageAndIdentifier($storageUid,
$fileIdentifier);
The hashIdentifier function in TYPO3 source utilizes the standard php-sha1 function, just in case you do not want to utilize the TYPO3-API.
Upvotes: 1