PHP code example of milad / yii2-mongodb-upload-file

1. Go to this page and download the library: Download milad/yii2-mongodb-upload-file 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/ */

    

milad / yii2-mongodb-upload-file example snippets


'fileManager' => [
    'class'                    => \miladh\file\FileManager::className(),
    'alias'                    => \miladh\file\models\File::ALIAS_FRONTEND,
    'db'                       => 'db',
    'defaultImageThumbnail'    => '@frontend/web/images/thumb-image.jpg',
    'defaultDocumentThumbnail' => '@frontend/web/images/thumb-document.jpg',
    'defaultAudioThumbnail'    => '@frontend/web/images/thumb-audio.jpg',
    'defaultVideoThumbnail'    => '@frontend/web/images/thumb-video.jpg',
    'defaultOtherThumbnail'    => '@frontend/web/images/thumb-other.jpg',
]

/** @var FileManager $fileManager */
$fileManager = \Yii::$app->fileManager;

$fileInstance = UploadedFile::getInstanceByName('files');
/** @var miladh\file\models\File $file */
$file = $fileManager->upload($fileInstance);

php yii mongodb-migrate --migrationPath=@miladh/yii2-upload-file/src/migrations