Italian (Italy)
Knowledge Base  >  Vik Appointments  >  Hook  >  Media  >  Check Allowed Path

apply_filters( 'vikappointments_check_path_allowed', bool $allow, string $fileJModel $model )

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

$allow

(bool)  True to always allow the file upload, false to rely on the default algorithm.

$file

(string)  The file path to check.

$model

(JModel)  The model instance that handles the saving process.


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  boolean  $allow  True to allow the file upload.
 * @param  string   $file   The file path to check.
 * @param  JModel   $model  The model instance.
 */
add_filter('vikappointments_check_path_allowed', function($allow, $file, $model)
{
    /**
     * @todo apply some custom validations
     */

    return $allow;
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Ultimo aggiornamento: 2021-08-09
Utile?
Potrebbe interessarti:
This site uses cookies. By continuing to browse you accept their use. Further information