2017 © Pedro Peláez
 

library upload-helper

Helper for upload different files.

image

tasmaniski/upload-helper

Helper for upload different files.

  • Thursday, June 15, 2017
  • by tasmaniski
  • Repository
  • 1 Watchers
  • 1 Stars
  • 530 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Upload helper

Manage - filter, validate and upload files., (*1)

Install

Add in you composer.json file:, (*2)

{
    "require": {
        "tasmaniski/upload-helper": "^1.0"
    }
}

Don't forget to run composer update., (*3)

Example

use Zend\Http\PhpEnvironment\Request;
use UploadHelper\Upload;


$files              = (new Request())->getFiles();                  // Return all files from $_FILE
$public_path        = '/var/www/website/public/uploads';            // better read it from config
$non_public_path    = '/var/www/website/data/uploads';
$upload             = new Upload($public_path, $non_public_path);   // Build upload object

$image = $upload->filterImage($files, 'image_name');  // image_name is the name from HTML form file input
$name  = $upload->uploadFile($image, 'image_name');   // After this the file is uploaded :) 
$path  = $upload->getWebPath($name);                  // If you need path for the Web or API

var_dump($name, $path);


Will display:
32f45151a816ffe96d571964f64faa20.png                    // File name
/uploads/3/2/f/32f45151a816ffe96d571964f64faa20.png     // Path to file

The Versions

15/06 2017

v1.1.3

1.1.3.0 https://github.com/tasmaniski

Helper for upload different files.

  Sources   Download

The Requires

 

by Aleksandar Varnicic

upload helper

15/06 2017

v1.1.2

1.1.2.0 https://github.com/tasmaniski

Helper for upload different files.

  Sources   Download

The Requires

 

by Aleksandar Varnicic

upload helper

16/01 2017

v1.1.1

1.1.1.0 https://github.com/tasmaniski

Helper for upload different files.

  Sources   Download

The Requires

 

by Aleksandar Varnicic

upload helper

12/01 2017

v1.1.0

1.1.0.0 https://github.com/tasmaniski

Helper for upload different files.

  Sources   Download

The Requires

 

by Aleksandar Varnicic

upload helper

10/01 2017

v1.0.1

1.0.1.0 https://github.com/tasmaniski

Helper for upload different files.

  Sources   Download

The Requires

 

by Aleksandar Varnicic

upload helper

09/01 2017

v1.0.0

1.0.0.0 https://github.com/tasmaniski

Helper for upload different files.

  Sources   Download

The Requires

 

by Aleksandar Varnicic

upload helper