PHPackages                             pa-bru/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. pa-bru/file-uploader

ActiveLibrary

pa-bru/file-uploader
====================

File uploader for PHP

v1.0(9y ago)2331MITPHPPHP &gt;=5.3.0

Since Jan 31Pushed 3y ago1 watchersCompare

[ Source](https://github.com/pa-bru/file-uploader)[ Packagist](https://packagist.org/packages/pa-bru/file-uploader)[ Docs](https://github.com/Seldaek/monolog)[ RSS](/packages/pa-bru-file-uploader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

FileUploader!
=============

[](#fileuploader)

Presentation
------------

[](#presentation)

FileUploader is a php class which enables you to upload files on your website !

### features :

[](#features-)

- Upload various type of files. You can choose the allowed formats.
- Rename uploaded files
- Choose location of the uploaded files
- Image resizing

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

[](#installation)

FileUploader is available via [Composer/Packagist](https://packagist.org/packages/pa-bru/file-uploader), so just add this line to your `composer.json` file:

```
"pa-bru/file-uploader": "~1.0"
```

or

```
composer require pa-bru/file-uploader
```

Usage
-----

[](#usage)

### Call the class:

[](#call-the-class)

```
$file = $_FILES["myfile"];

$args = [
	  "fileName" => "my-filename",
          "contentDir" => "my-directory/",
          "allowedExts" => array(),
          "maxSize" => 1000000,
          "width" => 200,
          "height" => 300
];

$uploader = new FileUploader($file, $args);
```

$file : File upload data table **$file is required**

$args : table arguments that can be passed to the constructor **$args is optional**. eg: `$uploader = new FileUploader($file);`

### Properties

[](#properties)

- `fileName` : name of file. If not specified, a single string is assigned.
- `contentDir` : Destination folder of the file added. The folder is created if it does not exist.
- `allowedExts` : Table of allowed extensions.
- `maxSize` : The maximum file size in bytes.
- `width` : In pixel (px) for resizing images (PNG, JPEG, JPG, GIF).
- `height` : In pixel (px) for resizing images (PNG, JPEG, JPG, GIF).

### Get the parameters (Getters) :

[](#get-the-parameters-getters-)

- Get file extension :

```
$uploader->getFileExtension();
```

- Get the destination path of the file :

```
$uploader->getPath();
```

- Get the height to be assigned to the image file :

```
$uploader->getHeight();
```

- Get the width to be assigned to the image file :

```
$uploader->getWidth();
```

- Get the maximum file size :

```
$uploader->getMaxSize();
```

- Get the destination folder of the file :

```
$uploader->getContentDir();
```

- Get the filename :

```
$uploader->getFileName();
```

- Get file data table :

```
$uploader->getTmpFile();
```

- Get the allowed extensions for uploading a file :

```
$uploader->getAllowedExts();
```

### Set the parameters (Setters) :

[](#set-the-parameters-setters-)

- Set file path :

```
$uploader->setPath($path);
```

- Set the height to be assigned to the file (if it is an image) :

```
$uploader->setHeight($height);
```

- Set the width to be assigned to the file (if it is an image):

```
$uploader->setWidth($width);
```

- Set the maximum size allowed for file upload :

```
$uploader->setMaxSize($maxSize);
```

- Set the destination folder of the file :

```
$uploader->setContentDir($contentDir);
```

- Set the name to be assigned to the file :

```
$uploader->setFileName($fileName);
```

- Set the file to upload :

```
$uploader->setTmpFile($tmpFile);
```

- Set the table of allowed extensions for file upload :

```
$uploader->setAllowedExts(array $allowedExts);
```

### Launch upload :

[](#launch-upload-)

```
$uploader->upload();
```

**If successful the upload () method returns the path of the uploaded file.**

Releases
--------

[](#releases)

**v1.0 :**

- Initial Version

Author
------

[](#author)

- Paul-Adrien Bru [Linkedin](https://fr.linkedin.com/in/pauladrienbru "Visit My Linkedin")

Copyright © 2016 Paul-Adrien Bru | MIT license

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3385d ago

### Community

---

Top Contributors

[![pa-bru](https://avatars.githubusercontent.com/u/14804459?v=4)](https://github.com/pa-bru "pa-bru (9 commits)")

### Embed Badge

![Health badge](/badges/pa-bru-file-uploader/health.svg)

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

PHPackages © 2026

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