Your cart is empty!
Check Allowed Path
public function onCheckPathAllowed(string $file, JModel $model) : bool
Fires while checking whether the upload folder is allowed.
Description
Trigger hook to allow the plugins to extend the validation of a specific path, in order to support the upload on folders that are not supported by default.
NOTE: the system checks whether the folder of the file to upload is contained within the default list of accepted paths. For this reason, it is possible to use the following code in order to extend the list with an additional path.
if (!in_array($my_new_path, $model->allowedPaths))
{
$model->allowedPaths[] = $my_new_path;
}
Parameters
- $file
-
(string) The file path to check.
- $model
-
(JModel) The model instance that handles the saving process.
Return Value
Boolean. True to always allow the file upload, false to rely on the default algorithm.
Example
/**
* Trigger event to allow the plugins to extend the validation of
* a specific path, in order to support the upload on folders that
* are not supported by default.
*
* @param string $file The file path to check.
* @param JModel $model The model instance.
*
* @return boolean True to allow the file upload.
*/
public function onCheckPathAllowed($file, $model)
{
/**
* @todo apply some custom validations
*/
return true;
}
Changelog
Version | Description |
---|---|
1.7 | Introduced. |
Last Update: 2021-10-08 13:46
Helpful?