1. Go to this page and download the library: Download cybernic/yii2-dropzone 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/ */
public function actionUpload()
{
$fileName = 'file';
$uploadPath = './files';
if (isset($_FILES[$fileName])) {
$file = \yii\web\UploadedFile::getInstanceByName($fileName);
//Print file data
//print_r($file);
if ($file->saveAs($uploadPath . '/' . $file->name)) {
//Now save file data to database
echo \yii\helpers\Json::encode($file);
}
}
return false;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.