dicicip / php-file-upload
v1.1.3-alpha
2020-12-11 13:30 UTC
Requires
- php: ^7.2.5
- intervention/image: ^2.5
This package is auto-updated.
Last update: 2024-09-11 21:33:18 UTC
README
PHP File Upload Utils is a library that makes it easy to handle uploaded file.
Requirements
- PHP >= 7
Features
- Handle uploaded file [ Base64 | File ] to temporary folder
- Auto generate thumbnail with custom quality (0 - 100)
- Move temporary uploaded file and thumbnail to real folder
Getting started
Step 1: Installation
The recommended way to install PHP File Upload Utils
is through
Composer.
composer require dicicip/php-file-upload
Step 2: Define on your class
<?php class YourClass { private $fileUtil; public function __construct() { $this->fileUtil = new Dicicip\FileUpload\FileUtil('path-to-file-folder', 'relative-path'); } }
Documentation
Upload file to temporary folder :
public function yourFunction() { $fileInfo = $this->fileUtil->storeBase64ToTemp('[String Base64]', 15); }
Move temporary uploaded file and thumbnail to real folder :
public function yourFunction() { $fileInfo = $this->fileUtil->storeTempFileTo('[relative-path]', '[target-relative-directory]'); }