承接 kukux/modern-file-upload 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kukux/modern-file-upload

Composer 安装命令:

composer require kukux/modern-file-upload

包简介

This is Modern File Upload

README 文档

README

Latest Version on Packagist Total Downloads License

A modern, React-powered file upload and file viewer plugin for Filament. Supports Filament ^3.0, ^4.0, and ^5.0 with image previews, PDF thumbnails, gallery and list views, dark mode, and an optional document action system (verify/return) as a drop-in Filament form field and infolist entry.

Features

  • Custom file upload field with drag & drop, progress tracking, and multi-file support
  • PDF thumbnail rendering using pdfjs-dist
  • Image & file viewer with zoom, pan, and page navigation
  • Dark mode support out of the box
  • Gallery and list view modes
  • Optional file actions — attach verify/return controls per file (e.g. for document approval workflows)
  • Assets loaded on demand — JS only loads on pages that use the components

Requirements

  • PHP ^8.2
  • Laravel version compatible with your chosen Filament major
  • Filament ^3.0, ^4.0, or ^5.0
  • Node.js (only needed if contributing or publishing changes)

Installation

Install via Composer:

composer require kukux/modern-file-upload

Important

This plugin ships pre-built JS assets. After installation or package updates, run php artisan filament:assets in your app so Filament can publish the package assets.

1. Add Plugin Views to Your Tailwind Config

If you are using a custom Filament theme (recommended), add the plugin's source paths so Tailwind includes its utility classes:

// tailwind.config.js
export default {
    darkMode: 'class',
    content: [
        // ... your existing paths
        './vendor/kukux/modern-file-upload/resources/views/**/*.blade.php',
        './vendor/kukux/modern-file-upload/resources/js/**/*.jsx',
    ],
}

Then rebuild your theme:

npm run build

2. Publish Filament Assets

Run:

php artisan filament:assets

3. Temporary Preview Behavior

Fresh uploads are previewed in the browser before the form is saved, so no extra Livewire page trait is required for normal image or PDF previews.

If your app still uses Livewire temporary preview configuration for PDFs, make sure the preview_mimes entry uses the extension format:

'temporary_file_upload' => [
    'preview_mimes' => [
        'png',
        'gif',
        'bmp',
        'svg',
        'wav',
        'mp4',
        'mov',
        'avi',
        'wmv',
        'mp3',
        'm4a',
        'jpg',
        'jpeg',
        'mpga',
        'webp',
        'wma',
        'pdf',
    ],
],

Use 'pdf', not 'application/pdf'.

Usage

File Upload Field (Form)

use Kukux\ModernFileUpload\Forms\Components\FileUpload;

public static function form(Form $form): Form
{
    return $form->schema([
        FileUpload::make('attachment')
            ->label('Upload File')
            ->disk('public')
            ->directory('uploads/attachments')
            ->accept('application/pdf')     
            ->multiple()                    
    ]);
}

File Viewer Entry (Infolist)

use Kukux\ModernFileUpload\Infolists\Components\FileViewer;

public static function infolist(Infolist $infolist): Infolist
{
    return $infolist->schema([
        FileViewer::make('attachment')
            ->label('Attached File')
            ->showDownload()
            ->showPdfThumbnails(),
    ]);
}

Optional: File Actions (Verify / Return)

For document approval workflows, you can attach per-file action controls (verify and return buttons) to any upload field. These only appear on already saved files — not on fresh temporary uploads.

1. Add a Livewire method to your resource or page

public function updateAction(int $fileId, string $action, ?string $remarks = null): void
{
    $file = Attachment::findOrFail($fileId);

    $file->update([
        'status'  => $action,
        'remarks' => $remarks,
    ]);
}

2. Attach the action to your field

FileUpload::make('attachment')
    ->disk('public')
    ->directory('uploads/attachments')
    ->accept('application/pdf')
    ->fileAction(function ($record) {
        return [
            'method' => 'updateAction',     // your Livewire method name
            'fileId' => $record?->id,
            'status' => $record?->status,   // "verified" | "returned" | null
        ];
    })

The verify/return buttons will appear on each saved PDF thumbnail. A confirmation modal is shown before any action is taken. Returned documents require a remarks/reason field before confirming.

Available Methods

FileUpload

Method Description
->disk(string $disk) Storage disk (default: public)
->directory(string $path) Upload directory
->accept(string $mime) Accepted MIME types (e.g. application/pdf, image/*)
->multiple(bool $condition) Allow multiple file uploads
->fileAction(\Closure $callback) Attach verify/return action controls

FileViewer

Method Description
->showDownload(bool $condition) Show download button (default: true)
->showPdfThumbnails(bool $condition) Render PDF first-page thumbnails (default: true)

Changelog

Please see CHANGELOG for what has changed in each release.

Contributing

Contributions are welcome! Please see CONTRIBUTING for details.

Security

If you discover a security vulnerability, please review our Security Policy.

Credits

License

The MIT License (MIT). Please see the License File for more information.

kukux/modern-file-upload 适用场景与选型建议

kukux/modern-file-upload 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 28 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「filament-plugin」 「filamentphp」 「modern-file-upload」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 kukux/modern-file-upload 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kukux/modern-file-upload 我们能提供哪些服务?
定制开发 / 二次开发

基于 kukux/modern-file-upload 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 28
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-28