coderatio / uploadia
一个灵活的PHP文件上传库
v0.1
2018-07-14 16:12 UTC
Requires
- php: >=5.4
This package is auto-updated.
Last update: 2024-09-19 12:55:27 UTC
README
一个灵活的PHP文件上传库
下载
composer require coderatio/uploadia
或者克隆此仓库。
使用方法
require 'vendor/autoload.php'; // if you downloaded via composer // OR require 'pathtouploadia/src/Uploadia.php'; $uploadia = new Coderatio\Uploadia\Uploadia(); $uploadia->setDir('uploads') ->setExtensions(['jpg', 'png', 'jpeg', 'gif']) ->setMaxSize(1); // In megabytes. 1MB // There are several methods to use. e.g $uploadia->allowAllFormats() // $uploadia->sameName($bool) takes a boolean. e.t.c if($uploadia->uploadFile('photo') { // photo is the file input name. // Get the uploaded file name or get error message. $uploadia->getUploadName(); // Returns uploaded file name; $uploadia->getMessage(); // Returns error messages }
贡献
将项目分支出来并提交pull request,通过josiahoyahaya@gmail.com给我发送邮件,或者在Twitter上找到我,并在任何可能的地方告诉我。
许可证
本项目遵循MIT许可证。