19 Dec 2021 02:26:57 UTC
- Distribution: Yancy
- Module version: 1.088
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (17)
- Testers (216 / 35 / 3)
- KwaliteeBus factor: 1
- 77.17% Coverage
- License: perl_5
- Perl: v5.16.0
- Download (1.34MB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:17 non-PAUSE users
- 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
EXPERIMENTALand 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/uploadsin the application's home directory.
The URL used to reach the
file_root. Defaults to
The name to use for the helper. Defaults to
yancy.filehelper). Change this to add multiple file plugins.
Doug Bell <firstname.lastname@example.org>
This software is copyright (c) 2021 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.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|