erykai / upload
Upload media, files and images
Fund package maintenance!
Erykai
Requires
- php: >=8.0
- ext-fileinfo: *
README
Upload media, files, images and upload url
Installation
Composer:
"erykai/upload": "1.2.*"
Terminal
composer require erykai/upload
Create config.php
//define name folder uploads system const UPLOAD_DIR = 'storage'; //define mimetypes accepts const UPLOAD_MIMETYPE = [ 'image/jpeg', 'image/gif', 'image/png', 'image/svg+xml', 'audio/mpeg', 'video/mp4', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/pdf' ];
Upload $_FILES
require "config.php"; require "vendor/autoload.php"; use Erykai\Upload\Upload; $upload = new Upload(); $upload->save(); print_r($upload->response());
Upload $_POST url
require "config.php"; require "vendor/autoload.php"; use Erykai\Upload\Upload; $upload = new Upload($_POST['cover'], 'cover'); $upload->save(); print_r($upload->response());
Upload url
require "config.php"; require "vendor/autoload.php"; use Erykai\Upload\Upload; $upload = new Upload('https://web.com/pdf.pdf', 'document'); $upload->save(); print_r($upload->response());
Create object and delete
if($upload->save()){ $user = new stdClass(); foreach ($upload->response()->data as $key => $value) { $user->$key = $value; $file = true; } } //case delete if($file){ $upload->delete(); print_r($upload->response()); }
Delete image
$upload->delete("storage/image/2022/08/10/imagem.jpg"); print_r($upload->response());
Contribution
All contributions will be analyzed, if you make more than one change, make the commit one by one.
Support
If you find faults send an email reporting to webav.com.br@gmail.com.
Credits
- Alex de O. Vidal (Developer)
- All contributions (Contributors)
License
The MIT License (MIT). Please see License for more information.