GithubHelp home page GithubHelp logo

dframe / filestorage Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 1.0 2.52 MB

Adapter League\Flysystem - File system manager with stylist and cache generator

Home Page: https://dframeframework.com/en/docs/fileStorage/master/configuration

License: MIT License

PHP 100.00%
filestorage filesystem storage flysystem images files file stylist image-stylist dframe

filestorage's People

Contributors

amadeuszxd avatar dusta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

amadeuszxd

filestorage's Issues

Add validation method isAllowedFileType()

Transfer to the validation method

Before:

$filename = $_FILES['file']['name'];
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); //Walidacja Rozszerzenia

$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $_FILES['file']['tmp_name']);  //Walidacja Mine
finfo_close($finfo);

if (!in_array($mime, ['application/pdf']) OR !in_array($extension, ['pdf'])) {
    return Response::renderJSON(['code' => 403, 'message' => 'Allowed only: \'pdf\''])
        ->status(403)
        ->display();
}

After:

$FileStorage->isAllowedFileType($filename, ['pdf'])

More flexible __construct

Add More __construct with config interface

In Storage.php

   public function __construct($driver = null)

Separation of constructor parameters

Before

 public function __construct($config, $image, $default = false, $storage)

After

public function __construct($driver, $config)
public function setImage($image, $default = false)

camelCase config

CamelCase config

Before

return [
    'pluginsDir' => dirname(__DIR__) . '/',
    'adapters' => [
        'local' => $local,
        'cache' => $cacheFilesystem,
        'web' => $web
    ],
    'cache' => [
        'life' => 600 // in seconds
    ],
    'public_urls' => [
        'local' => ''
    ]
];

After

return [
    'pluginsDir' => dirname(__DIR__) . '/',
    'adapters' => [
        'local' => $local,
        'cache' => $cacheFilesystem,
        'web' => $web
    ],
    'cache' => [
        'life' => 600 // in seconds
    ],
    'publicUrls' => [
        'local' => ''
    ]
];

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.