Download the PHP package aminyazdanpanah/handling-file-uploads without Composer

On this page you can find all versions of the php package aminyazdanpanah/handling-file-uploads. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package handling-file-uploads

Handling File Uploads

Build Status Latest Version on Packagist Scrutinizer Code Quality Software License Code Intelligence Status Total Downloads

Handles multiple uploads with a powerful validation for images, videos, audios, and archive files. This package allows you to handle your file after your file was uploaded. You can resize, convert, extract and so many things to do after your files were uploaded. At the end, you can extract details of files into an array.

Features

Installation

This version of the package is only compatible with PHP 7.1.0 and later.

Install the package via composer:

Basic Usage

upload multiple files
upload a single files

Important: Please see examples for more information. In these pages you can see complete examples of usage this package.

Documentation

It is recommended to browse the source code as it is self-documented.

Configuration

In the sever side you should create an array of config and pass it to uploads() method:

For more information about these attributes, please check the below tables:

Attributes of array of config
attr default mean
name mandatory: must be specified The key name you send your file to the server-PHP($_Files).
save_to mandatory: must be specified The path that you would like to save your file in the server or computer.
save_as Base file name The name that you want to save.
override false Override original file with the same filename.
validator no rules Validate your file before save(see validator table).
export Nothing happens A callback method that you specify additional rules and manage your file after it was uploaded.

Validation

Before Saving

You can validate your uploaded file before move the uploaded file to the destination. There are some rules that you can apply on your file:

Attributes of validator
attr default mean
min_size 1 The minimum size of files that are allowed (KiloByte).
max_size 999999 The maximum size of files that are allowed (KiloByte).
types '*' (everything) The types that are allowed (must be an array)

After Saving

You can set some rules after move the uploaded file to the destination by using a callback method. To validate a file after saving, just check your file in the callback method and throw an AYazdanpanah\SaveUploadedFiles\Exception\Exception. In the end, put it in the array of config and pass it to Upload::files($config). In the callback method, you can manage your file. For example, resize image or video, convert video, extracting an archive file and etc. After that, you are able to return your data.

Validate and Manage a Video file

There are some factors that can use to validate a video. I recommended PHP-FFMpeg-video-streaming package that is a wrapper around PHP-FFmpeg. You can validate your video by using its codec, duration, width, height, ratio, and other its attributes. After that, depends on whether your file is valid or not, you can throw an Exception. At the end, as it can be seen below, you can convert your video or whatever you want to do with your file and export your data:

For more information, please read PHP FFMPEG Video Streaming documentation and php-ffmpeg documentation.

Validate and Manage an image file

To validate and manage an image, I recommended php-image-resize package. For more information I strongly recommand to read php-image-resize documantation . After that, depends on whether your file is valid or not, you can throw an Exception. At the end, you can export your data:

Validate and Manage an archive file

To validate and manage an archive file, I recommended using UnifiedArchive package. For more information I strongly recommand to read UnifiedArchive documantation . After that, depends on whether your file is valid or not, you can throw an Exception. At the end, you can export your data:

Validate and Manage an audio file

To validate and manage an archive file, I recommended using php-ffmpeg package. For more information I strongly recommand to read php-ffmpeg . After that, depends on whether your file is valid or not, you can throw an Exception. At the end, you can export your data:

Exporting Data

After uploading, class return an object that is instance of Filter. You can export all details of your upload by using all() method:

Other possible methods

Examples

For see complete example, please go to examples.

Contributing

I'd love your help in improving, correcting, adding to the specification. Please file an issue or submit a pull request.

Please see Contributing File for more information.

Security

If you discover a security vulnerability within this package, please send an e-mail to Amin Yazdanpanah via: contact [AT] aminyazdanpanah • com.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of handling-file-uploads with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
aminyazdanpanah/php-ffmpeg-video-streaming Version 1.1.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aminyazdanpanah/handling-file-uploads contains the following files

Loading the files please wait ....