PHP code example of lanyunit / laravel-uploader
1. Go to this page and download the library: Download lanyunit/laravel-uploader 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/ */
lanyunit / laravel-uploader example snippets
return [
'allow' => [
'audio' => [
'mime' => ['audio/mpeg'],
'max_size' => 30
],
'video' => [
'mime' => ['video/mp4', 'video/quicktime', 'video/mpeg', 'video/avi'],
'max_size' => 30
],
'files' => [
'mime' => '*',
'max_size' => 30
],
'image' => [
'mime' => ['image/jpeg', 'image/png', 'image/gif'],
'max_size' => 30
],
]
];
return [
'disks' => [
//...
'uploader' => [
'driver' => 'uploader',
'type' => 'local', // local tencent qiniu aliyun
'max_size' => 30, // 30MB
'expire_time' => 30 * 60, // seconds
'callback_url' => '', // upload callback url
'prefix' => 'image', // upload directory prefix
'qiniu' => [
"bucket" => "your-bucket" // bucket name,
"domain" => "your-domain.com" // assets domain,
"access_key" => env('QINIU_ACCESS_KEY'),
"secret_key" => env('QINIU_SECRET_KEY')
],
'aliyun' => [
"bucket" => "your-bucket", // bucket name,
"isCName" => false, // is custom domain
"endpoint" => "oss-cn-shanghai.aliyuncs.com", // your bucket endpoint
"access_key_id" => env('ALIYUN_ACCESS_KEY_ID'),
"access_key_secret" => env('ALIYUN_ACCESS_KEY_SECRET')
],
'tencent' => [
"app_id" => "your-app-id", // tencent app id
"bucket" => "your-bucket", // bucket name,
"region" => "ap-beijing", // bucket region
"secret_id" => env('TENCENT_SECRET_ID'),
"secret_key" => env('TENCENT_SECRET_KEY')
]
],
//...
]
];
use Illuminate\Support\Facades\Route;
use Lanyunit\FileSystem\Uploader\Controllers\Callback;
Route::post('callback', [Callback::class, 'index']);
$storage = app('filesystem')->disk('uploader');
// Web Direct Transfer
dd($storage->getAdapter()->getTokenConfig('image'));
bash
php artisan vendor:publish --tag="uploader-config"