2017 © Pedro Peláez
 

joomla-package filesystem

Joomla Filesystem Package

image

joomla/filesystem

Joomla Filesystem Package

  • Saturday, July 14, 2018
  • by mbabker
  • Repository
  • 9 Watchers
  • 1 Stars
  • 26,413 Installations
  • PHP
  • 14 Dependents
  • 1 Suggesters
  • 10 Forks
  • 4 Open issues
  • 13 Versions
  • 6 % Grown

The README.md

The Filesystem Package Build Status

File upload example

use Joomla\Filesystem\File;

$file = $this->input->files->get('file');

$config = array(
    'extensions'    => 'jpg,jpeg,gif,png,pdf,doc,docx',
    'max_size'      => 30000000, // 30 MB
    'folder'        => 'documents'
);

// Check there is some file to upload
if (empty($file['name']))
{
    return;
}

// Check max size
if ($file['size'] > $config['max_size'])
{
    throw new \RuntimeException('Uploaded file size (' . round($file['size'] / 1000) . ' kB) is greater than allowed size (' . round($config['max_size'] / 1000) . ' kB).');
}

$config['extensions'] = explode(',', $config['extensions']);

// Get File extension
$ext = strtolower(substr($file['name'], (strrpos($file['name'], '.') + 1)));

// Sanitize allowed extensions
foreach ($config['extensions'] as &$extension)
{
    $extension = str_replace('.', '', trim(strtolower($extension)));
}

// Check allowed extensions
if (!in_array($ext, $config['extensions']))
{
    throw new \RuntimeException('Uploaded file extension (' . $ext . ') is not within allowed extensions (' . implode(',', $config['extensions']) . ')');
}

$path = JPATH_ROOT . '/' . $config['folder'] . '/' . File::makeSafe($file['name']);

File::upload($file['tmp_name'], $path);

Installation via Composer

Add "joomla/filesystem": "~1.0" to the require block in your composer.json and then run composer install., (*1)

{
    "require": {
        "joomla/filesystem": "~1.0"
    }
}

Alternatively, you can simply run the following from the command line:, (*2)

composer require joomla/filesystem "~1.0"

If you want to include the test sources, use, (*3)

composer require --prefer-source joomla/filesystem "~1.0"

The Versions

14/07 2018

dev-2.0-dev

dev-2.0-dev https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

  • php ~7.0

 

The Development Requires

filesystem framework joomla

01/07 2018

dev-master

9999999-dev https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

  • php ^5.3.10|~7.0

 

The Development Requires

filesystem framework joomla

01/07 2018

1.4.0

1.4.0.0 https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0-or-later

The Requires

  • php ^5.3.10|~7.0

 

The Development Requires

filesystem framework joomla

10/12 2016

1.3.1

1.3.1.0 https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

  • php ^5.3.10|~7.0

 

The Development Requires

filesystem framework joomla

05/09 2015

1.3.0

1.3.0.0 https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

filesystem framework joomla

14/06 2015

dev-cms-fix

dev-cms-fix https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

filesystem framework joomla

10/04 2014

1.2.0

1.2.0.0 https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

filesystem framework joomla

09/02 2014

1.1.1

1.1.1.0 https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

 

filesystem framework joomla

03/02 2014

1.1.0

1.1.0.0 https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

 

filesystem framework joomla

22/10 2013

1.0-beta3

1.0.0.0-beta3 https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

 

filesystem framework joomla

16/08 2013

1.0-beta2

1.0.0.0-beta2 https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

 

filesystem framework joomla

16/08 2013

1.0-beta

1.0.0.0-beta https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

 

filesystem framework joomla

04/06 2013

1.0-alpha

1.0.0.0-alpha https://github.com/joomla/joomla-framework-filesystem

Joomla Filesystem Package

  Sources   Download

GPL-2.0+

The Requires

 

filesystem framework joomla