umbraco-file-upload-preview

Umbraco File Upload Preview

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "umbraco-file-upload-preview" with this command: npx skills add umbraco/umbraco-cms-backoffice-skills/umbraco-umbraco-cms-backoffice-skills-umbraco-file-upload-preview

Umbraco File Upload Preview

What is it?

File Upload Previews are custom web components that render previews for specific file types during upload in Umbraco. They allow you to create visual representations for files based on their MIME types, such as displaying thumbnails for images, waveforms for audio, or custom icons for specific file formats.

Documentation

Always fetch the latest docs before implementing:

Related Foundation Skills

  • Umbraco Element: Base class for creating UI components

  • Reference skill: umbraco-umbraco-element

Workflow

  • Fetch docs - Use WebFetch on the URLs above

  • Ask questions - What MIME types? What preview display?

  • Generate files - Create manifest + element based on latest docs

  • Explain - Show what was created and how to test

Minimal Examples

Manifest (manifests.ts)

export const manifests: Array<UmbExtensionManifest> = [ { type: 'fileUploadPreview', alias: 'My.FileUploadPreview.Custom', name: 'Custom File Upload Preview', weight: 100, element: () => import('./my-file-preview.element.js'), forMimeTypes: ['application/pdf', 'application/x-pdf'], }, ];

Element Implementation (my-file-preview.element.ts)

import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import type { UmbFileUploadPreviewElement } from '@umbraco-cms/backoffice/media';

@customElement('my-file-preview') export class MyFilePreviewElement extends UmbLitElement implements UmbFileUploadPreviewElement { @property({ type: Object }) file?: File;

@state() private _previewUrl?: string;

override updated(changedProperties: Map<string, unknown>) { if (changedProperties.has('file') && this.file) { this._previewUrl = URL.createObjectURL(this.file); } }

override disconnectedCallback() { super.disconnectedCallback(); if (this._previewUrl) { URL.revokeObjectURL(this._previewUrl); } }

override render() { if (!this.file) return html``;

return html`
  &#x3C;div class="preview-container">
    &#x3C;uui-icon name="icon-document">&#x3C;/uui-icon>
    &#x3C;span>${this.file.name}&#x3C;/span>
  &#x3C;/div>
`;

} }

export default MyFilePreviewElement;

Interface Reference

interface ManifestFileUploadPreview extends ManifestElement<UmbFileUploadPreviewElement> { type: 'fileUploadPreview'; forMimeTypes: string | Array<string>; // e.g., 'image/*', ['image/png', 'image/jpeg'] }

interface UmbFileUploadPreviewElement { file?: File; }

Common MIME Type Patterns

  • image/*

  • All image types

  • video/*

  • All video types

  • audio/*

  • All audio types

  • application/pdf

  • PDF files

  • /

  • Fallback for all types (use with lower weight)

That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

umbraco-backoffice

No summary provided by upstream source.

Repository SourceNeeds Review
General

umbraco-dashboard

No summary provided by upstream source.

Repository SourceNeeds Review
General

umbraco-quickstart

No summary provided by upstream source.

Repository SourceNeeds Review
General

umbraco-extension-template

No summary provided by upstream source.

Repository SourceNeeds Review