hcipl / dropzone-with-dropbox
Dropzone 文件上传与 Dropbox
dev-master
2023-06-14 12:22 UTC
Requires
- sawirricardo/laravel-dropbox: ^0.2.0
This package is auto-updated.
Last update: 2024-10-03 10:37:23 UTC
README
使用 Dropbox 进行 Dropzone 文件上传。
实时链接 : (https://packagist.org.cn/packages/hcipl/dropzone-with-dropbox)
使用方法
- 安装包: "composer require hcipl/dropzone-with-dropbox".
- 配置数据库 ".env" 文件。
- 首先,您需要在 Dropbox 获取一个授权令牌。与其他公司不同,Dropbox 使这一过程变得非常简单。您只需在 应用控制台 为任何 Dropbox API 应用生成令牌。更多信息请参阅 Dropbox 开发者博客。
- 在 .env 文件中设置 Dropbox 配置
- 在 AppServiceProvider.php 中将 Dropbox 配置为驱动程序
public function boot()
{
Storage::extend('dropbox', function (Application $app, array $config) {
$adapter = new DropboxAdapter(new DropboxClient(
$config['authorization_token']
));
return new FilesystemAdapter(
new Filesystem($adapter, $config),
$adapter,
$config
);
});
}
- 在 config/filesystems.php 中的 "disks" 下添加一个新的驱动程序。
'dropbox' => [
'driver' => 'dropbox',
'key' => env('DROPBOX_APP_KEY'),
'secret' => env('DROPBOX_APP_SECRET'),
'authorization_token' => env('DROPBOX_AUTHORIZATION_TOKEN', null),
'case_sensitive' => true,
]
- 运行迁移: "php artisan migrate"
- 运行项目服务器 "php artisan serve",
- 测试 URL "http://127.0.0.1:8000/image/index"
视图修改
为了修改 dropzone
- 选择 "Provider:Hcipl\dropzoneWithDropbox\DropzoneWithDropboxServiceProvider" 选项。
- 运行以下命令发布资源。php artisan vendor:publish --tag=public --force