Download the PHP package sokil/php-upload without Composer
On this page you can find all versions of the php package sokil/php-upload. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-upload
PHP Uploader
- Installation
- Related packages
- Quick start
- Nginx configuration
- Using upload_module and upload_progress_module (nginx < 1.3.9)
- Using client_body_in_file_only directive
Installation
You can install library through Composer:
Related packages
- https://github.com/sokil/upload.js - frontend component. Implements uploading wile without reloading page with upload progress
- https://github.com/sokil/php-upload-sandbox - Sandbox to test backend (this library) and frontend (https://github.com/sokil/upload.js). To start testing just clone repo and start server.
- https://github.com/sokil/FileStorageBundle - Symfony bundle
Quick start
First create HTML:
Then add PHP code to upload action to upload file to local system:
Also library supports Gaufrette filesistems. Read about Gaufrette at https://github.com/KnpLabs/Gaufrette. Read abount configuring Gaufrette filesystems in Symfony at https://github.com/KnpLabs/KnpGaufretteBundle.
To upload file into Gaufrette Filesystem:
Upload transports
Stream upload
Nginx upload
Multipart Form Data Transport
Nginx configuration
During standard upload file is moved to php's temp dir, and then moved to target
destination using move_uploaded_file
. If this dirs on different
physical drives, some time will be spend to move file physically between devices.
There is another reason when nginx + php-fpm stack used.
During upload nginx stored file to its own temp dir. After passing control to
php-fpm, nginx moves cached file to php's temp dir, and than php moves file
to destination using move_uploaded_file
. So file copied three times, and
maybe on different physical devices.
This method moves file directly to configured drive, so in php code only rename of file required.
Using upload_module and upload_progress_module (nginx < 1.3.9)
_This method is deprecated due to compilation errors of upload_module
on nginx versions 1.3.9+._
Nginx must be compiled with this modules:
-
Upload module: https://github.com/vkholodkov/nginx-upload-module
- Upload progress module: https://github.com/masterzen/nginx-upload-progress-module
Example of nginx configuration to handle upload and progress:
Using client_body_in_file_only directive
See more info at http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_in_file_only
Currently not supported