PHPackages                             azurre/php-simple-file-uploader - 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. azurre/php-simple-file-uploader

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

azurre/php-simple-file-uploader
===============================

Simple and powerful file uploader with validation

2.0.1(5y ago)082MITPHP

Since Oct 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/azurre/php-simple-file-uploader)[ Packagist](https://packagist.org/packages/azurre/php-simple-file-uploader)[ Docs](https://github.com/azurre/php-simple-file-uploader)[ RSS](/packages/azurre-php-simple-file-uploader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)DependenciesVersions (9)Used By (0)

Simple file uploader [![Latest Version](https://camo.githubusercontent.com/4822319327c8620bdf613cc8daa2cdc7917b3f49b3fe93d8b8497cce73398aa5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f617a757272652f7068702d73696d706c652d66696c652d75706c6f616465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/azurre/php-simple-file-uploader/releases)
=================================================================================================================================================================================================================================================================================================================================================================================================

[](#simple-file-uploader-)

Small, comfortable and powerful file uploader

Features
--------

[](#features)

- No dependencies
- Easy to use
- Easy to validate
- Easy to extend/customize
- Upload by URL
- Unified upload result
- Cyrillic transliteration

Installation
------------

[](#installation)

Install composer in your project:

```
curl -s https://getcomposer.org/installer | php

```

Require the package with composer:

```
composer require azurre/php-simple-file-uploader

```

Usage
-----

[](#usage)

### Simple example

[](#simple-example)

```
$loader = require_once __DIR__ . '/vendor/autoload.php';

use Azurre\Component\Http\Uploader;

if (isset($_FILES['file'])) {
    try {
        $uploader = Uploader::create()->upload('file');
    } catch (\Exception $e) {
        exit("Error: {$e->getMessage()}");
    }
    echo $uploader->getFirstFile()->getFullPath();
}

?>

```

Output

```
/var/www/Test_5cd31dbb246530.38121881.xlsx

```

### Example

[](#example)

```
if (isset($_FILES['file'])) {
    try {
        $uploader = Uploader::create()
            ->setDestination('./')
            ->setOverwrite(false)// Overwrite existing files?
            ->setNameFormat(Uploader::NAME_FORMAT_ORIGINAL)
            ->setReplaceCyrillic(false)// Transliterate cyrillic names
            ->addValidator(Uploader::VALIDATOR_MIME, ['image/png', 'image/jpeg'])
            ->addValidator(Uploader::VALIDATOR_EXTENSION, ['png', 'jpg'])
            ->addValidator(Uploader::VALIDATOR_SIZE, '1M');

        // After upload callback
        $uploader->afterUpload(function ($file) {
            //do something
        });

        $customData = 'KEY';
        // Custom name formatter. If you will use custom formatter setNameFormat() setReplaceCyrillic() will be ignored.
        $uploader->setNameFormatter(function ($file, $upl) use ($customData) {
            /** @var Uploader\File $file */
            /** @var Uploader $upl */
            $newName = str_replace(' ', '-', $file->getName());
            $newName = Uploader::transliterate($newName);
            $newName .= uniqid("_{$customData}_", true) . ".{$file->getExtension()}";
            return $newName;
        });

        $uploader->upload('file');
        echo '' . print_r($uploader->getFiles(), true) . '';
    } catch (\Exception $e) {
        echo 'Error:' . $e->getMessage();
    }
}

?>

```

Output

```
Array
(
    [0] => Azurre\Component\Http\Uploader\File Object
        (
            [data:protected] => Array
                (
                    [name] => Новая Картинка
                    [full_name] => Новая Картинка.jpg
                    [new_name] => Novaya-Kartinka_KEY_5cd32798d81c15.93269375.jpg
                    [full_path] => /var/www/pricer.local/public/Novaya-Kartinka_KEY_5cd32798d81c15.93269375.jpg
                    [extension] => jpg
                    [mime_type] => image/jpeg
                    [tmp_name] => /tmp/phpd2DBTm
                    [size] => 280012
                    [error_code] => 0
                )
        )
    [1] => Azurre\Component\Http\Uploader\File Object
        (
            [data:protected] => Array
                (
                    [name] => web-server-certificate
                    [full_name] => web-server-certificate.png
                    [new_name] => web-server-certificate_KEY_5cd32798d82f45.89296123.png
                    [full_path] => /var/www/pricer.local/public/web-server-certificate_KEY_5cd32798d82f45.89296123.png
                    [extension] => png
                    [mime_type] => image/png
                    [tmp_name] => /tmp/php93mYNo
                    [size] => 70652
                    [error_code] => 0
                )
        )
)

```

### Example upload by URL

[](#example-upload-by-url)

```
$url = 'https://img.shields.io/github/release/azurre/php-simple-file-uploader.svg?style=flat-square';
try {
    $uploader = Uploader::create()->uploadByUrl($url);
    echo '' . print_r($uploader->getFirstFile(), true) . '';
} catch (\Exception $e) {
    echo 'Error:' . $e->getMessage();
}
```

Output

```
Azurre\Component\Http\Uploader\File Object
(
    [data:protected] => Array
        (
            [name] => php-simple-file-uploader
            [full_name] => php-simple-file-uploader.svg
            [new_name] => php-simple-file-uploader_5cd32cc8d0b301.55846637.svg
            [full_path] => /var/www/pricer.local/public/php-simple-file-uploader_5cd32cc8d0b301.55846637.svg
            [extension] => svg
            [mime_type] => image/svg
            [tmp_name] => /tmp/upload9wl2BK
            [size] => 952
            [error_code] => 0
        )

)

```

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~230 days

Recently: every ~401 days

Total

8

Last Release

1888d ago

Major Versions

1.5.1 → 2.0.02019-05-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/f5bbeafb1d06ec9c1ba940980a19a3fd3902cef3499a446726677986be73b0ec?d=identicon)[a.milenin](/maintainers/a.milenin)

---

Top Contributors

[![azurre](https://avatars.githubusercontent.com/u/2183975?v=4)](https://github.com/azurre "azurre (25 commits)")

---

Tags

validationimagefileupload

### Embed Badge

![Health badge](/badges/azurre-php-simple-file-uploader/health.svg)

```
[![Health](https://phpackages.com/badges/azurre-php-simple-file-uploader/health.svg)](https://phpackages.com/packages/azurre-php-simple-file-uploader)
```

###  Alternatives

[itskodinger/midia

Simple Media manager for your Laravel project

1415.8k](/packages/itskodinger-midia)[liyunfang/yii2-upload-behavior

Upload behavior for Yii 2

161.7k](/packages/liyunfang-yii2-upload-behavior)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
