承接 ashiful/upload 相关项目开发

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

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

ashiful/upload

Composer 安装命令:

composer require ashiful/upload

包简介

Laravel Secure File Upload & Media Guard

README 文档

README

A robust, secure, and modern Laravel package for handling file uploads with virus scanning, MIME validation, and frontend integration.

Features

  • 🔒 Secure Uploads: MIME validation, extension checks.
  • 🦠 Virus Scanning: Hookable interface (ClamAV ready).
  • ⏱️ Temporary Access: Signed URLs for temporary file access.
  • 🧹 Orphan Cleanup: Auto-delete temporary files via Artisan command.
  • 🖼️ Frontend Ready: Drag & Drop components for Blade, React, and Vue.
  • 🧩 SOLID Architecture: Swappable drivers.

Installation

Add the package to your composer.json (if local) or install via composer.

composer require ashiful/upload

Configuration

Publish the configuration file:

php artisan vendor:publish --tag=upload-config

Customization

You can publish the views and assets to modify them:

# Publish views to resources/views/vendor/upload
php artisan vendor:publish --tag=upload-views

# Publish JS/Vue/React components to resources/js/vendor/ashiful/upload
php artisan vendor:publish --tag=upload-assets

Usage

Backend Service

use Ashiful\Upload\Facades\SecureUpload;

// Basic Upload
$path = SecureUpload::upload($request->file('file'), 'uploads');

// Get Signed URL
$url = SecureUpload::getSignedUrl($path, 60); // 60 minutes

Cleanup Command

Add to your App\Console\Kernel.php schedule or run manually:

php artisan upload:cleanup --hours=24

Frontend Components

Blade

Include the Blade component in your view:

@include('upload::dropzone')

React

Import the component:

import ReactUpload from '../../packages/ashiful/upload/resources/js/components/ReactUpload';

<ReactUpload uploadUrl="/upload/media" csrfToken={token} />

Vue

Import the component:

import VueUpload from '../../packages/ashiful/upload/resources/js/components/VueUpload.vue';

<VueUpload upload-url="/upload/media" :csrf-token="token" />

Testing

To run the package tests specifically:

php artisan test packages/ashiful/upload

laravel-upload

统计信息

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

GitHub 信息

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

其他信息

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