PHPackages                             samsonos/php\_upload - 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. samsonos/php\_upload

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

samsonos/php\_upload
====================

43175JavaScript

Since Nov 19Pushed 11y ago2 watchersCompare

[ Source](https://github.com/samsonos/php_upload)[ Packagist](https://packagist.org/packages/samsonos/php_upload)[ RSS](/packages/samsonos-php-upload/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (2)Used By (0)

SamsonPHP Upload module
=======================

[](#samsonphp-upload-module)

[![Latest Stable Version](https://camo.githubusercontent.com/c04a7b89813fc2a360dfc39739b341f1b36942e52d0cd6c4867464ad914a9267/68747470733a2f2f706f7365722e707567782e6f72672f73616d736f6e6f732f7068705f75706c6f61642f762f737461626c652e737667)](https://packagist.org/packages/samsonos/php_upload)[![Build Status](https://camo.githubusercontent.com/1dc74e2b7cc2c1850ef5dc96a750f68818f76d88310734054fd01fbf337df6a1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e6f732f7068705f75706c6f61642f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsonos/php_upload/badges/build.png?b=master)[![Code Coverage](https://camo.githubusercontent.com/8ea403b9460dc2e8a440a2b62b941a19fb123a95b052641abff01dc46637b053/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e6f732f7068705f75706c6f61642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsonos/php_upload/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/b6e568385f01efc8557f97059b08722caae87d7cb134c96e62e0c1abb7df7e77/68747470733a2f2f706f7365722e707567782e6f72672f73616d736f6e6f732f7068705f75706c6f61642f646f776e6c6f6164732e737667)](https://packagist.org/packages/samsonos/php_upload)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/064d0c69880cafbb12302c103c6035aa1f8434e9001dd59070c5008b0974ba9b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e6f732f7068705f75706c6f61642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsonos/php_upload/?branch=master)[![Stories in Ready](https://camo.githubusercontent.com/8774961068006d5394128726b0f5959980249dace63d501db9dbc1d7ce4f275f/68747470733a2f2f62616467652e776166666c652e696f2f73616d736f6e6f732f7068705f75706c6f61642e706e673f6c6162656c3d7265616479267469746c653d5265616479)](https://waffle.io/samsonos/php_upload)

Connection
----------

[](#connection)

To use this module in your project you must add dependency in your `composer.json`:

```
"require": {
    "samsonos/php_upload": "*"
},
```

After doing `composer install` or `composer update` you will get all classes and functions of Upload module.

Configuration
-------------

[](#configuration)

Configuration for Upload module is not necessary, but you can use it if you want to create unique file name or upload dir name for uploading files.
If you will not use configuration, your upload catalog will be called 'upload' and file name will be random generated.

Thanks to [SamsonPHP module/service configuration](https://github.com/samsonphp/config) you can create simple config class:

```
class UploadConfig extends \samson\core\Config
{
    // Callback function for creating upload dir
    public $uploadDirHandler = 'uploadDirHandler';

    // Callback function for creating file name
    public $fileNameHandler = 'uploadNameHandler';
}
```

Create async file uploading
---------------------------

[](#create-async-file-uploading)

The main feature of current module is asynchronous file uploading. Look at the example.

### Example of HTML code

[](#example-of-html-code)

First of all you need to create html container with your file input:

```
