PHP code example of flow / plupload-endpoint

1. Go to this page and download the library: Download flow/plupload-endpoint library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flow / plupload-endpoint example snippets


use Flow\PluploadEndpoint\JsonResponseHandler;
use Flow\PluploadEndpoint\Pluploader;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\Request;

$request = Request::createFromGlobals();

$filesystem = new Filesystem();

$pluploader = new Pluploader($request, $filesystem, './uploads');

$handler = new JsonResponseHandler($pluploader);

$response = $handler->handle(); // returns Symfony\Component\HttpFoundation\Response

$response->send(); // Sends JSON to browser

class Uploads extends Controller
{
	public function upload()
	{
        $pluploader = new Pluploader(
            App::make('request'),
            new \Symfony\Component\Filesystem\Filesystem(),
            '../app/storage/uploads'
        );

		$handler = new JsonResponseHandler($pluploader);

		return $handler->handle();
	}
}