PHP code example of orh / laravel-upload

1. Go to this page and download the library: Download orh/laravel-upload 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/ */

    

orh / laravel-upload example snippets


// app/config/app.php

'providers' => [
...

AetherUpload\AetherUploadServiceProvider::class,
];

// app/config/aetherupload.php
...

'upload_path' => public_path() . '/attachment',

// app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
    ...
    
    $schedule->call(function () {
        \AetherUpload\ResourceHandler::cleanUpDir();
    })->daily();
}

// app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
    ...
    
    $schedule->call(function () {
        \AetherUpload\RedisHandler::build();
    })->daily();
}
shell
php artisan vendor:publish --tag=aetherupload-config
shell
php artisan vendor:publish --tag=aetherupload
shell
# 列出所有分组并自动创建对应目录
php artisan aetherupload:groups

# 在 Redis 中重建资源文件的 hash 清单 
php artisan aetherupload:build

# 清除几天前的无效临时文件
php artisan aetherupload:clean