Giter Club home page Giter Club logo

codeigniter4-files's Introduction

Tatter\Files

File uploads and management, for CodeIgniter 4

Quick Start

  1. Install with Composer: > composer require tatter/files
  2. Migrate the database: > php spark migrate -all
  3. Seed the database: > php spark db:seed "Tatter\Files\Database\Seeds\FileSeeder"
  4. Start managing files: https://[yourdomain.com]/files

Features

The Files module is a self-contained set of routes and functions that adds uploading and CRUD controls to any project. It uses DropzoneJS for drag-and-drop uploads, and supports a number of extensions for directing files to other locations (WIP).

Installation

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

  • > composer require tatter/files

Or, install manually by downloading the source files and adding the directory to app/Config/Autoload.php.

Once the files are downloaded and included in the autoload, run any library migrations to ensure the database is setup correctly:

  • > php spark migrate -all

Finally, run the seeder to install necessary database settings: php spark db:seed "Tatter\Files\Database\Seeds\FileSeeder"

NOTE: If your project is part of a tracking repository you probably want to add the file storage to your .gitignore

writable/files/*
!writable/files/index.html

Configuration (optional)

The library's default behavior can be altered by extending its config file. Copy bin/Files.php to app/Config/ and follow the instructions in the comments. If no config file is found in app/Config the library will use its own.

Usage

Default routes:

  • files/index - If user is allowed mayList() then shows all files, otherwise tries to fall back to the current logged in user
  • files/user - Shows files for a single user; if no user ID is supplied it defaults to the current logged in user

Available formats:

  • ?format=cards - Default view with thumbnail on responsive layout
  • ?format=list - An efficient list of files in table format
  • ?format=select - Can be used to create selectable files, e.g. as part of a form

Access control

This library uses Tatter\Permits to control access to files, both generally (list, create) and specifically per user or group. The super-permit mayAdmin() can be added to a user or group for global file access.

By default the files/ routes are available as soon as the module is installed. In most cases you will want to use Route Filters to restrict some or all of the routes.

codeigniter4-files's People

Contributors

mgatner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.