PHPackages                             yanli0303/yii-uploaded-file - 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. yanli0303/yii-uploaded-file

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

yanli0303/yii-uploaded-file
===========================

A wrapper for CUploadedFile class of PHP Yii framework.

v0.1(11y ago)014MITPHPPHP &gt;=5.3

Since Mar 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/yanli0303/Yii-UploadedFile)[ Packagist](https://packagist.org/packages/yanli0303/yii-uploaded-file)[ RSS](/packages/yanli0303-yii-uploaded-file/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Yii-UploadedFile
================

[](#yii-uploadedfile)

*By [Yan Li](https://github.com/yanli0303)*

[![Build Status](https://camo.githubusercontent.com/fa81c736710a37a6a64de33a356a3feb506483b2227015dbf6840a7333e6ec41/68747470733a2f2f7472617669732d63692e6f72672f79616e6c69303330332f5969692d55706c6f6164656446696c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yanli0303/Yii-UploadedFile)[![Coverage Status](https://camo.githubusercontent.com/501e601b9116a6e44dc142f8d49e046dd6d10effff4442f492051af006501e26/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f79616e6c69303330332f5969692d55706c6f6164656446696c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/yanli0303/Yii-UploadedFile?branch=master)[![License](https://camo.githubusercontent.com/1a2e0606685ce00663bf829868f794fd3fc9c86f8d80cae324734129e0723a58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e737667)](https://packagist.org/packages/yanli0303/yii-uploaded-file)[![PayPayl donate button](https://camo.githubusercontent.com/6f1f24b30244c5434ccb5adebe7692acfe95a9740c9aae282f2864334ef51438/687474703a2f2f696d672e736869656c64732e696f2f62616467652f70617970616c2d646f6e6174652d6f72616e67652e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=silentwait4u%40gmail%2ecom&lc=US&item_name=Yan%20Li&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3apaypal%2ddonate%2ejpg%3aNonHostedGuest)

A wrapper for CUploadedFile class of PHP Yii framework. It adds following help methods to CUploadedFile class:

- isExtensionInList($extensions)
- isMimeTypeInList($mimeTypes)
- isImageTypeInList($imageTypes)
- validateImageDimensions($maxWidth, $maxHeight, $minWidth, $minHeight)
- validate($maxFileBytes, $allowedExtensions, $allowedMimeTypes)
- validateImage($maxFileBytes, $allowedExtensions, $allowedImageTypes, $maxWidth = null, $maxHeight = null, $minWidth = null, $minHeight = null)
- saveImage($saveAs, $pngToJpg = false)

Usage
-----

[](#usage)

```
$maxBytes = 4194304; //4 * 1024 * 1024 = 4MB
$allowedExtensions = array('.png', '.jpg', '.jpeg');
$allowedTypes = array(IMAGETYPE_JPEG, IMAGETYPE_PNG);

$uploaded = new UploadedFile('file');
$error = $uploaded->validateImage($maxBytes, $allowedExtensions, $allowedTypes);
if (is_string($error)) {
    throw new Exception($error);
}

$saveAs = '/webroot/uploads/images/'.basename($uploaded->file->getName());
$saved = $uploaded->saveImage($saveAs, false);
if (empty($saved)) {
    throw new Exception('Sorry, we couldn\'t upload the image.');
}

// do sth with saved image: $saved
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

4085d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e340371c515137e6faf42b5a2b12e974242352e6cc7d46cd0e0fc61f890a104?d=identicon)[yanli0303](/maintainers/yanli0303)

---

Top Contributors

[![yanli0303](https://avatars.githubusercontent.com/u/3038713?v=4)](https://github.com/yanli0303 "yanli0303 (14 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yanli0303-yii-uploaded-file/health.svg)

```
[![Health](https://phpackages.com/badges/yanli0303-yii-uploaded-file/health.svg)](https://phpackages.com/packages/yanli0303-yii-uploaded-file)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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