https://github.com/coderatio/uploadia
A flexible PHP file upload library
https://github.com/coderatio/uploadia
Last synced: 12 months ago
JSON representation
A flexible PHP file upload library
- Host: GitHub
- URL: https://github.com/coderatio/uploadia
- Owner: coderatio
- License: mit
- Created: 2018-07-14T16:03:42.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-02T23:47:37.000Z (over 5 years ago)
- Last Synced: 2025-01-31T22:11:25.438Z (over 1 year ago)
- Language: PHP
- Size: 10.7 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Uploadia
A flexible PHP file upload library
# Download
``composer require coderatio/uploadia``
Or Clone this repo.
# Usage
```php
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
}
```
# Contribution
Fork the project and send pull request, email me via josiahoyahaya@gmail.com, find me on Twitter and say something about it anywhere possible.
# Licence
This project is licenced under MIT license.