File attachment plugin for RainLab blog module
This plugin extends the RainLab Blog plugin with file attachment features., (*1)
This plugin wants you to install RainLab Blog plugin first., (*2)
composer require reizinixc/blogattachment && echo /plugins/reizinixc/blogattachment >> .gitignore
After install this plugin, you will see the "Attachments" option in "Manage" tab., (*3)
If you can upload featured images, you can upload files by click the plus icon and choose the files., (*4)
When you retrieve the blog post. You can get all attached files by attachments
attribute e.g. posts.attachments
and get attached files by iterating through attachments
or use an array index., (*5)
Here are some accessible fields of attachment object., (*6)
Fields | Description |
---|---|
content_type | Get MIME type of file |
created_at | Get a creation datetime of file |
description | Get a file description |
extension | Get a file extension |
file_name | Get a file name |
file_size | Get a file size in Bytes |
path | Get a download URI of file |
title | Get a file title |
{% for attachment in post.attachments %} <a href="{{ attachment.path }}">{{ attachment.file_name }} ({{ attachment.file_size }}B)</a> {% endfor %}
I will salute you if you create an issue or a pull request. Please feel free to do it :), (*7)
MIT, (*8)