Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/litto/uploader
File Uploader Class for Files in PHP
https://github.com/litto/uploader
Last synced: about 1 month ago
JSON representation
File Uploader Class for Files in PHP
- Host: GitHub
- URL: https://github.com/litto/uploader
- Owner: litto
- License: mit
- Created: 2022-02-07T05:10:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-07T05:20:01.000Z (almost 3 years ago)
- Last Synced: 2024-11-14T03:52:41.493Z (about 1 month ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# File Uploader
File Uploader Class for Files in PHP
##How to Install?
Install Using Composer or Direcly you can download from the Github Code You can install via composer by using this command:-
composer require litto/uploader:v1.0
## How it works?
When File is submitted in a form. In the save function call like this:-
$absDirName = dirname(dirname(__FILE__)).'/uploads'; // uploads folder where you are storing files
$uploader = new Uploader($absDirName.'/'); //Initilize Class passing the uploader path
$uploader->setExtensions(array('jpg','jpeg','png','gif')); // Restrict the Formats valid for thsi file upload
$uploader->setSequence('page'); // You can set name sequence or you can pass the slug varibale for making seo friendly
$uploader->setMaxSize(2); // Set size of the Uploader file in MB
if($uploader->uploadFile("txtFile")){ // Class is uplaoding file where our file field name is txtFile
/*
* File uploader successfully , now store to Db
*/
$image = $uploader->getUploadName(); //getting uploaded file name
// You can store the file in your database
}