UploadCache#
NAME#
Kernel::System::Web::UploadCache - an upload file system cache
DESCRIPTION#
All upload cache functions.
PUBLIC INTERFACE#
new()#
Don’t use the constructor directly, use the ObjectManager instead:
my $WebUploadCacheObject = $Kernel::OM->Get('Kernel::System::Web::UploadCache');
The agent and customer interfaces set the owner of the current request via ObjectParamAdd(), so that all upload cache entries are bound to and checked against the logged in user:
$Kernel::OM->ObjectParamAdd(
'Kernel::System::Web::UploadCache' => {
UserID => 123, # agent UserID or customer UserLogin
UserType => 'User', # 'User' or 'CustomerUser'
},
);
Without an owner (e.g. console commands, daemon) no ownership check is done.
FormIDCreate()#
create a new Form ID
my $FormID = $UploadCacheObject->FormIDCreate();
FormIDRemove()#
remove all data for a provided Form ID
$UploadCacheObject->FormIDRemove( FormID => 123456 );
All methods working on a Form ID accept the optional parameters UserID and UserType. They default to the owner given via ObjectParamAdd() (see new()). Access is denied if the Form ID belongs to another owner.
$UploadCacheObject->FormIDRemove(
FormID => 123456,
UserID => 123, # optional
UserType => 'User', # optional, 'User' or 'CustomerUser'
);
FormIDAddFile()#
add a file to a Form ID
$UploadCacheObject->FormIDAddFile(
FormID => 12345,
Filename => 'somefile.html',
Content => $FileInString,
ContentType => 'text/html',
Disposition => 'inline', # optional
);
ContentID is optional (automatically generated if not given on disposition = inline)
$UploadCacheObject->FormIDAddFile(
FormID => 12345,
Filename => 'somefile.html',
Content => $FileInString,
ContentID => 'some_id@example.com',
ContentType => 'text/html',
Disposition => 'inline', # optional
);
FormIDRemoveFile()#
removes a file from a form id
$UploadCacheObject->FormIDRemoveFile(
FormID => 12345,
FileID => 1,
);
FormIDGetAllFilesData()#
returns an array with a hash ref of all files for a Form ID
my @Data = $UploadCacheObject->FormIDGetAllFilesData(
FormID => 12345,
);
Return data of on hash is Content, ContentType, ContentID, Filename, Filesize, FileID;
FormIDGetAllFilesMeta()#
returns an array with a hash ref of all files for a Form ID
Note: returns no content, only meta data.
my @Data = $UploadCacheObject->FormIDGetAllFilesMeta(
FormID => 12345,
);
Return data of hash is ContentType, ContentID, Filename, Filesize, FileID;
FormIDCleanUp()#
Removed no longer needed temporary files.
Each file older than 1 day will be removed.
$UploadCacheObject->FormIDCleanUp();