PHPackages                             mjangir/mjangiruploader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. mjangir/mjangiruploader

ActiveLibrary[File &amp; Storage](/categories/file-storage)

mjangir/mjangiruploader
=======================

A simple library to easily handle file uploads, downloads and move with any PHP framework.

29[1 issues](https://github.com/mjangir/mkjuploader/issues)PHP

Since Oct 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mjangir/mkjuploader)[ Packagist](https://packagist.org/packages/mjangir/mjangiruploader)[ RSS](/packages/mjangir-mjangiruploader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

mkjuploader
===========

[](#mkjuploader)

A simple library to easily handle file uploads, downloads and move with any PHP framework.

Basically the library employs adapter concept to upload the files whether they are being uploaded in local directory or any third party storage. Currently I have only local adapter injected by default but I'm coming with other third party adapters like AmazonS3 etc.

### How To Install Mkjuploader

[](#how-to-install-mkjuploader)

```
$ composer require "mjangir/mkjuploader":"dev-master"
```

### How To Use

[](#how-to-use)

The package can be used for various purposes I'm describing in the following.

#### 1. Upload A File

[](#1-upload-a-file)

A file can be uploaded following the below steps: 1. Create a suitable adapter having upload path and public path
2. Create the main Upload object and pass the adapter in it
3. Crate the File object for posted input
4. Use the upload function of Uploader object
5. It will return the actual uploaded file key

Refer the below code to work with immediately

**Create a database first**

```
CREATE DATABASE /*!32312 IF NOT EXISTS*/`mkjuploader` /*!40100 DEFAULT CHARACTER SET latin1 */;

/*Table structure for table `files` */

DROP TABLE IF EXISTS `files`;

CREATE TABLE `files` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `key` varchar(255) NOT NULL,
  `created` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
```

**Write the PHP code**index.php

```
