Skip to content

Instantly share code, notes, and snippets.

@Boorj
Forked from rossriley/uploadSanitiser.php
Created November 23, 2017 10:05
Show Gist options
  • Save Boorj/b4e6dea23ba835b94b24ee046e65b970 to your computer and use it in GitHub Desktop.
Save Boorj/b4e6dea23ba835b94b24ee046e65b970 to your computer and use it in GitHub Desktop.
Bolt: Extending the upload handler with custom sanitiser
$app['upload'] = $app->share(
$app->extend(
'upload',
function ($uploadHandler) {
$uploadHandler->setSanitizerCallback(
function ($filename) {
// Do things with filename string here.
return $filename;
}
);
return $uploadHandler;
}
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment