Download the PHP package rossriley/upload without Composer

On this page you can find all versions of the php package rossriley/upload. 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 upload

Sirius\Upload

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version License

Framework agnostic upload handler library.

Features

  1. Validates files agains usual rules: extension, file size, image size (wdith, height, ratio). It uses Sirius Validation for this purpose.
  2. Moves valid uploaded files into containers. Containers are usually local folders but you can implement your own or use other filesystem abstractions like Gaufrette or Flysystem.

Elevator pitch

One aggregator to rule them all

Sometimes your form may upload multiple files to the server. To reduce the number of process(), clear() and confirm() calls you can use an "upload handler aggregate"

You can see the aggregator and handlers in action in the tests/web/index.php

How it works

  1. Uploaded file is validated against the rules. By default the library will check if the upload is valid (ie: no errors during upload)
  2. The name of the uploaded file is sanitized (keep only letters, numbers and underscore and lowercase the result). You may implement your own sanitization function if you want.
  3. If overwrite is not allowed, and a file with the same name already exists in the container, the library will prepend the timestamp to the filename.
  4. Moves the uploaded file to the container. It also create a lock file (filename + '.lock') so that we know the upload is not confirmed
  5. If something wrong happens in your app and you want to get rid of the uploaded file you can clear() the uploaded file which will remove the file and its .lock file. Only files that have a coresponding .lock file attached can be cleared
  6. If everything is in order you can confirm the upload. This will remove the .lock file attached to the upload file.

What is "locking"?

Usualy application accept file uploads to store them for future use (product images, people resumes etc). But from the time an uploaded file is moved to its container until the actual data is saved there are things that can go wrong (eg: the database goes down). For this reason the locking functionality was implemented. This way, even if you're not able to execute the clear() method you will be able to look into the container in "spot" the unused files. This feature must be used with care

  1. If you want to take advantage of this feature you must use confirm
  2. If you don't like it, use $uploadHandler->setAutoconfirm(true) and all uploaded files will automatically confirmed

Using different containers

If you want to store uploaded files in different locations your containers must implement the Sirius\Upload\Container\ContainerInterface.

You can easily create upload containers on top of Gaufrette or Flysystem.

Important notes

1. The library makes no assumptions about the "web availability" of the uploaded file.

Most of the times once you have a valid upload the new file will be reachable on the internet. You may upload your files to /var/www/public/images/users/ and have the files accessible at //cdn.domain.com/users/. It's up to you to make your app work with the result of the upload.

2. You can handle multiple uploads at once if they have the same name

If you upload multiple files with the same name (eg: <input type="file" name="pictures[]">) but you have to keep in mind that the process() and getMessages() methods will return arrays

In this case the library normalizes the $_FILES array as PHP messes up the upload array. It is up to you to decide what you want to do when some files fail to upload (eg: keep the valid files and continue or display error messages for the invalid images)


All versions of upload with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
rossriley/validation Version >=1.2
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 rossriley/upload contains the following files

Loading the files please wait ....