PHPackages                             coercive/fileupload - 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. coercive/fileupload

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

coercive/fileupload
===================

Coercive File Upload Utility

1.1.1(8y ago)117MITPHPPHP &gt;=5.4.0

Since Jul 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Coercive/FileUpload)[ Packagist](https://packagist.org/packages/coercive/fileupload)[ Docs](http://coercive.fr)[ RSS](/packages/coercive-fileupload/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Coercive FileUpload Utility
===========================

[](#coercive-fileupload-utility)

FileUpload enables you to manage file shipments : moving, copying , deleting temporary files , retrieving information ...

Get
---

[](#get)

```
composer require coercive/fileupload

```

Usage
-----

[](#usage)

**IMAGE**

```
use Coercive\Utility\FileUpload;

# EXAMPLE IMAGE FILE
$oImageUpload = new ImageUpload([
	ImageUpload::OPTIONS_NAME => 'img_file',
	ImageUpload::OPTIONS_ALLOWED_EXTENSIONS => ['jpeg', 'jpg', 'gif', 'png']
]);

# ERRORS
if($oImageUpload->getErrors()) { exit; }

# SAVE : add extension auto
$oImageUpload->save('/example/path/' . $sImgName_auto_extension);
if($oImageUpload->getErrors()) { exit; }

# Where is my file ?
$sMyFile = $oImageUpload->getDestPath();
```

**FILE**

```
use Coercive\Utility\FileUpload;

# EXAMPLE FILE
$oFileUpload = new FileUpload([
	FileUpload::OPTIONS_NAME => 'file',
	FileUpload::OPTIONS_ALLOWED_EXTENSIONS => ['pdf']
]);

# ERRORS
if($oFileUpload->getErrors()) { exit; }

# SAVE
$oFileUpload->save('/example/path/' . $sFileName . '.pdf');
if($oFileUpload->getErrors()) { exit; }
```

**MOD**

```
# EXAMPLE MOD
$oFileUpload = new FileUpload([
	FileUpload::OPTIONS_NAME => 'file',
	FileUpload::OPTIONS_CHMOD_DIR => 0777, # IF DIRECTORY NOT EXIST
	FileUpload::OPTIONS_CHMOD_FILE => 0777 # WHEN USE MOVE OR COPY
]);

# YOU CAN USE INTERNAL HELPER
$oFileUpload = new FileUpload([
	[ ... ]
	FileUpload::OPTIONS_CHMOD_DIR => FileUpload::CHMOD_OWNER_WRITE,
	FileUpload::OPTIONS_CHMOD_FILE => FileUpload::CHMOD_OWNER_READ,
	[ ... ]
]);

FileUpload::CHMOD_FULL; # 0777
FileUpload::CHMOD_OWNER_FULL; # 0700
FileUpload::CHMOD_OWNER_READ; # 0400
FileUpload::CHMOD_OWNER_WRITE; # 0200
FileUpload::CHMOD_OWNER_EXEC; # 0100
FileUpload::CHMOD_OWNER_FULL_GROUP_READ_EXEC; # 0750
FileUpload::CHMOD_OWNER_FULL_GROUP_READ_EXEC_GLOBAL_READ; # 0754
FileUpload::CHMOD_OWNER_FULL_GROUP_READ_EXEC_GLOBAL_READ_EXEC; # 0755
FileUpload::CHMOD_OWNER_READ_WRITE; # 0600
FileUpload::CHMOD_OWNER_READ_WRITE_GROUP_READ; # 0640
FileUpload::CHMOD_OWNER_READ_WRITE_GROUP_READ_GLOBAL_READ; # 0644
```

**HELP**

```
use Coercive\Utility\FileUpload;

# Need Something ?
$oFileUpload
    ->getDestPath();
...
    ->getFilePathInfo();
...
    ->getMaxFileSize();
...
    ->getFileSize();
...
    ->getFileError();
...
    ->getFileType();
...
    ->getFilePath();
...
    ->getFileExtension();
...
    ->getFileName();
...
    ->getErrors();
...
    ->getChmodDir();
...
    ->getChmodFile();

# You can delete temp file by using :
$oFileUpload
    ->deleteTempFile();
```

**OPTIONS**

```
# FileUpload / ImageUpload : Constructor Options
array(
    FileUpload::OPTIONS_NAME => '', # (string) input file name
    FileUpload::OPTIONS_ALLOWED_EXTENSIONS => [], # (array) of strings example : ['jpg', 'gif']
    FileUpload::OPTIONS_DISALLOWED_EXTENSIONS => [], # (array) of strings
    FileUpload::OPTIONS_MAX_SIZE => self::DEFAULT_MAX_SIZE, # (int) default : 10485760 (10 Mo)
    FileUpload::OPTIONS_CHMOD_DIR => self::DEFAULT_CHMOD_DIR, # (int) default : 0644
    FileUpload::OPTIONS_CHMOD_FILE => self::DEFAULT_CHMOD_FILE # (int) default : 0644
);
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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 ~288 days

Total

3

Last Release

3066d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20288080?v=4)[Coercive](/maintainers/Coercive)[@Coercive](https://github.com/Coercive)

---

Top Contributors

[![Coercive](https://avatars.githubusercontent.com/u/20288080?v=4)](https://github.com/Coercive "Coercive (1 commits)")

### Embed Badge

![Health badge](/badges/coercive-fileupload/health.svg)

```
[![Health](https://phpackages.com/badges/coercive-fileupload/health.svg)](https://phpackages.com/packages/coercive-fileupload)
```

PHPackages © 2026

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