Download the PHP package khanzadimahdi/uploadmanager without Composer
On this page you can find all versions of the php package khanzadimahdi/uploadmanager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package uploadmanager
PHP upload manager
Description
File upload manager can be used to upload chunk and non-chunk files.
Uploads can be resumed later(see "resumable-chunk-upload" example in "examples/js-example directory").
Add your files , upload them and close browser, next time you can open browser and resume the uncompleted uploads.
Features
- Multiple file upload: Allows to select multiple files at once and upload them simultaneously.
- Cancelable uploads: Individual file uploads can be canceled to stop the upload progress.
- Resumable uploads: Aborted uploads can be resumed later.
- Chunk uploads: Large files can be uploaded in smaller chunks.
- Customizable and extensible: Provides an interface to define callback methods for various upload events.
Getting started
Installation
Usage
Available Classes :
- UploadManager\Chunk : contains file's (or chunk) information.
- UploadManager\Upload : stores received files (or chunks).
Example: (simple file upload)
Files are in the "examples/simple-upload" directory
First we create a simple HTML form
Then we store file (or files) using the below codes:
if uploaded file has any errors or it cant be uploaded , the "upload" method throws an exception, so it's better to call this method in a try catch block.
Each file (or chunk) related errors can be retrieved by "getErrors" method as an array.
Validations
We can validate files (or chunks) before storing them.
a simple validation example is in "examples/using-validations" directory
Available validations :
- Extension
- MimeType
- Size
Example:
as you see, we can use "addValidations" method to add an array of validations.
you can use either available validations or creating a custom validation by implementing "UploadManager\Contracts\ValidationInterface" interface.
Callbacks
Here we have the below callbacks:
-
beforeValidate
-
afterValidate
-
beforeUpload
- afterUpload
Callbacks can be used to control the flow of uploading mechanism.
example:
Here we remove uploaded file (or chunk) if an error occurred.
Files are in the "examples/simple-callbacks" directory
More real examples
see the "examples/js-examples" directory for more real examples.
available examples:
-
Dropzone
-
JQuery file upload
-
Plupload
- Resumable-Chunk-Upload : the best example for resuming uploads in the future! in this example you need to create a database and import "server/medias.sql" in it , then change connection configs in "server/upload.php"
Requirements
requirements
- PHP v. 5.6+
- FileInfo ext : Required for recognizing file's mimeType.
Optional requirements
- Json ext : Used to return json messages can be used in client side.
Contributing
Please read the contribution guidelines before submitting a pull request.
Support
This project is actively maintained, but there is no official support channel.
License
Released under the MIT license.