PHP code example of joni-jones / yii2-fuploader

1. Go to this page and download the library: Download joni-jones/yii2-fuploader 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/ */

    

joni-jones / yii2-fuploader example snippets


<?= \jones\fuploader\FileUpload::widget();

    FileUpload::widget([
        'action' => Url::to(['some_action'])
    ]);
    

    FileUpload::widget([
        'options' => [
            'plugin' => [
                'formData' => 'some data',
            ],
        ],
        'content' => 'Select image',
    ]);
    

	FileUpload::widget([
            'clientEvents' => [
                'done' => 'function(e, data){console.log(data);}',
                'fail' => 'function(e, data){console.log(data);}'
            ]
	]);
	

	public function actions()
	{
            return[
                'some_action' => [
                    'class' => 'jones\fuploader\actions\UploadAction',
                    'path' => 'some path for uploading',
                    'url' => 'some url for uploaded file', //this url will be accessable in action response
                    'callback' => [$this, 'someCallback'] //any callable function
                ]
            ];
	}
	

	public function someCallback($request, $files)
	{
	    // some code
	}
	

php composer.phar