mercator/wn-uploader-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mercator/wn-uploader-plugin

Composer 安装命令:

composer require mercator/wn-uploader-plugin

包简介

Plugin providing frontend upload blocks for Winter CMS

README 文档

README

Uploader Plugin

The Uploader Plugin extends WinterCMS with a backend-managed upload system and frontend components for user file submission.
Editors create so-called "Upload Forms" in the backend and optionally assign which users are allowed to upload to each form.
Frontend pages or blocks reference these backend-defined forms using their Form ID, and optionally include a User ID for controlled access.

⚙️ Overview

This plugin provides:

  • Backend-defined upload forms (with user access lists).
  • A frontend upload component bound to a backend form.
  • QR code generators linking directly to upload pages.
  • Email notifications after successful uploads.
  • Themed .blocks for UIKit and Bootstrap frontends.

All upload logic depends on backend definitions — no form can function until it has been created there.

📦 Installation

Install the plugin via Composer:

composer require mercator/wn-uploader-plugin

Then apply database migrations:

php artisan winter:up

🧠 Concept

Layer Description
Backend Administrators create upload forms under Uploader → Forms, define allowed users (email, token, or ID), and optionally configure notification emails. Each form gets a unique Form ID.
Frontend CMS components and blocks reference the Form ID to render upload interfaces or QR codes. The frontend can optionally specify a User ID to enforce access control.

🧩 CMS Component: Uploader

Purpose

Renders a frontend upload form connected to a backend-defined upload form. Files are stored in the media folder. Note that files are NOT automatically deleted when the Upload Form is deleted.

Usage

In your CMS page or layout:

[Uploader]
formId = "ajnjcdshu73nsd"
userId = "mdswedjndso734jdsi832j"

Then in the page markup:

{% component 'uploader' %}

Parameters

Property Type Description
formId string The Form ID of the backend-defined upload form. Required.
userId string Optional ID or email matching one of the users defined in the backend form.

Example Twig Rendering

<div class="upload-section">
    {% component 'uploader' %}
</div>

If a form is missing or access is denied, the component displays:

“Upload form not found or user not permissioned.”

🧱 Pre-defined Blocks

Located in /blocks/, these provide ready-made upload and QR-code functionality. Each block references the backend Form ID and automatically enforces form permissions.

Block Purpose Style
upload.block Frontend uploader (UIKit) UIKit
upload_bootstrap.block Frontend uploader (Bootstrap) Bootstrap
qrcode.block QR code link to upload page (UIKit) UIKit
qrcode_bootstrap.block QR code link to upload page (Bootstrap) Bootstrap

🧮 Backend Usage

1. Upload Forms

Go to Uploader in the backend.

Each Upload Form contained there defines:

  • A unique Form ID
  • Title and Description shown in frontend blocks and components
  • Allowed users, identified by name, email, or ID
  • Upload constraints (file size, extensions, ...)
  • Notification email settings

Once created, the form can be referenced in frontend on CMS pages or using WinterCMS Blocks, both described above.

2. Access Control

User access can be defined per upload form. Each form specifies which users are authorized to upload.

Permission can be validated via:

uploaderUserIsPermissioned(form_id, user_id)

If the form does not exist or access is restricted and the user in not on the allowed list, the upload form is not displayed.

3. Email Notifications

Each upload form can optionally send email notifications to instruct them on file uplaoding and provide them with credentials. Notifications are sent to the authorized user defined in the form. The email will provide a link where the user will be able to upload his or her files.

4. Limitations for HEIF/HEIC

HEIF/HEIC images can be uploaded provided heif/heic are specified as allowed file extensions in the backend. In this caase, resizing and editing wll not be available for these types. Note that browsers do not support thse image types. Thefore a conversion libray will be lazy-loaded when such images are uploaded. This library is rather large and might into your bandwidth.

🔐 Access Summary

Scenario Allowed
Valid formId and permitted userId ✅ Upload allowed
Valid formId, no userId, and restricted = false ✅ Upload allowed
Valid formId, invalid userId and restricted = true ❌ Upload denied
Missing or invalid formId ❌ Upload denied

All checks are enforced server-side.

🧰 Developer Notes

  • Compatible with the dev instance of WinterCMS 1.2.8 and PHP 8.3
  • Uses System\Models\File for file storage
  • Works with both UIKit and Bootstrap
  • Helper functions:
    • uploaderForm(form_id)
    • uploaderUserIsPermissioned(form_id, user_id)
    • uploaderQRCode(url, size, margin)
    • uploaderUploaderOpen(form_id [, user_id]) returns 0 when upload is authorized.

📄 License

MIT License. See LICENSE for details.

👤 Author

Helmut Kaufmann, Küssnacht am Rigi, Switzerland, software@mercator.li mercator.li

mercator/wn-uploader-plugin 适用场景与选型建议

mercator/wn-uploader-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 mercator/wn-uploader-plugin 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-12