---
title: Upload Helpers
label: Upload Helpers
order: 290
desc: Display upload metadata, browse generated image variants, and edit image adjustments.
keywords: ui, components, upload, media, file details, preview sizes, crop, focal point
---

Payload's upload helpers support the file-management interface around an upload-enabled Collection. Use them when extending an upload workflow that already has a document, upload configuration, and the surrounding Admin context.

## Import

```tsx
import { EditUpload, FileDetails, PreviewSizes } from '@payloadcms/ui'
```

## File details

`FileDetails` presents a file thumbnail, URL, dimensions, size, and MIME type. It can also display removal, image-adjustment, generated-variant, and custom upload actions.

<ComponentPreview component="UploadHelpers" example="fileDetails" />

The component renders a static summary by default. Pass the sortable row props when it represents one item in a multi-upload field.

## Generated image variants

`PreviewSizes` lets users compare the original upload with image variants generated by the Collection's upload configuration.

<ComponentPreview component="UploadHelpers" example="previewSizes" />

The available options come from `uploadConfig.variants` and matching entries in `doc.variants`. Selecting an option updates the main preview and metadata.

## Image adjustments

`EditUpload` provides Payload's crop and focal-point controls. Use `showCrop` and `showFocalPoint` to expose the adjustments enabled by the upload Collection.

`EditUpload` renders inside Payload's shared upload-edit modal; rendering the component does not open it. Mount it as part of an existing upload workflow and open it through the image-adjustment action supplied by `Upload` or `FileDetails`.

```tsx
<EditUpload
  fileName={doc.filename}
  fileSrc={doc.url}
  initialCrop={doc.crop}
  initialFocalPoint={doc.focalPoint}
  onSave={(uploadEdits) => updateUploadEdits(uploadEdits)}
  showCrop
  showFocalPoint
/>
```

`onSave` receives the crop, focal point, and resulting pixel dimensions. The component closes Payload's upload-edit modal after applying the changes.

## Common props

These are the props most commonly used with this component family. See the exported types in `@payloadcms/ui` for the complete list.

### FileDetails

| Prop                  | Type                                  | Default | Description                                      |
| --------------------- | ------------------------------------- | ------- | ------------------------------------------------ |
| `collectionSlug` \*   | `string`                              | —       | Identifies the upload-enabled Collection.        |
| `doc` \*              | `Data & { variants?: FileSizes }`     | —       | Supplies file metadata and generated variants.   |
| `uploadConfig` \*     | `SanitizedCollectionConfig['upload']` | —       | Controls previews and available upload behavior. |
| `enableAdjustments`   | `boolean`                             | `false` | Shows the image-adjustment action.               |
| `hasImageSizes`       | `boolean`                             | `false` | Shows the generated-variant preview action.      |
| `hideRemoveFile`      | `boolean`                             | `false` | Hides the file-removal control.                  |
| `customUploadActions` | `ReactNode[]`                         | —       | Adds project-specific upload actions.            |

### PreviewSizes

| Prop              | Type                                             | Default | Description                                     |
| ----------------- | ------------------------------------------------ | ------- | ----------------------------------------------- |
| `doc` \*          | `Data & { variants?: Record<string, FileSize> }` | —       | Supplies original and generated image metadata. |
| `uploadConfig` \* | `SanitizedCollectionConfig['upload']`            | —       | Defines the configured image-variant order.     |
| `imageCacheTag`   | `string`                                         | —       | Appends a cache-busting tag to preview URLs.    |

### EditUpload

| Prop                | Type                           | Default | Description                                 |
| ------------------- | ------------------------------ | ------- | ------------------------------------------- |
| `fileName` \*       | `string`                       | —       | Labels the image being edited.              |
| `fileSrc` \*        | `string`                       | —       | Supplies the image URL.                     |
| `onSave`            | `(edits: UploadEdits) => void` | —       | Receives the applied image adjustments.     |
| `showCrop`          | `boolean`                      | `false` | Enables crop controls.                      |
| `showFocalPoint`    | `boolean`                      | `false` | Enables focal-point controls.               |
| `initialCrop`       | `UploadEdits['crop']`          | —       | Sets the initial crop region.               |
| `initialFocalPoint` | `{ x: number; y: number }`     | —       | Sets the initial focal point by percentage. |

_\* An asterisk denotes that a prop is required._

## Accessibility

- Provide meaningful upload `alt` data so generated-variant previews describe the underlying image.
- Keep file names and metadata available alongside visual thumbnails.
- Preserve keyboard access when adding custom upload actions.
- Label destructive removal actions clearly and confirm them when removal cannot be reversed.

## Provider requirements

`FileDetails` and `EditUpload` rely on upload, translation, and modal behavior supplied by the Admin Panel. `PreviewSizes` expects the normalized document and upload configuration produced by an upload-enabled Collection. For complete form and persistence behavior, use the exported `UploadField` component.
