- SEE ALSO
- COPYRIGHT AND LICENSE
Yancy::Plugin::File - Manage file uploads, attachments, and other assets
# Write a file $c->yancy->file->write( $c->param( 'upload' ) );
Note: This module is
EXPERIMENTAL and its API may change before Yancy v2.000 is released.
This plugin manages file uploads. Files are stored in the
This plugin API is meant to be subclassed by other asset storage mechanisms such as Hadoop or Amazon S3.
Files are NOT immediately deleted after they are no longer needed. Instead, a "cleanup" method exists to periodically clean up any files that are not referenced. You should schedule this to run daily or weekly in cron:
# Clean up files every week 0 0 * * 0 ./myapp.pl eval 'app->yancy->file->cleanup( app->yancy->backend, app->yancy->schema )'
$url_path = $c->yancy->file->write( $upload ); $url_path = $c->yancy->file->write( $name, $asset );
$app->yancy->file->cleanup( $app->yancy->backend ); $app->yancy->file->cleanup( $app->yancy->backend, $app->yancy->schema );
Clean up any files that do not exist in the given backend. Call this daily or weekly to remove files that aren't needed anymore.
This plugin has the following configuration options.
The root path to store files. Defaults to
public/uploads in the application's home directory.
The URL used to reach the
file_root. Defaults to
The name to use for the helper. Defaults to
file (creating a
yancy.file helper). Change this to add multiple file plugins.
Doug Bell <firstname.lastname@example.org>
This software is copyright (c) 2020 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.