Skip to content

Feat: Add custom openable/downloadable URLs support for file uploads#19481

Open
Abdulmajeed-Jamaan wants to merge 6 commits intofilamentphp:4.xfrom
Abdulmajeed-Jamaan:feat/custom-openable-url
Open

Feat: Add custom openable/downloadable URLs support for file uploads#19481
Abdulmajeed-Jamaan wants to merge 6 commits intofilamentphp:4.xfrom
Abdulmajeed-Jamaan:feat/custom-openable-url

Conversation

@Abdulmajeed-Jamaan
Copy link
Copy Markdown
Contributor

@Abdulmajeed-Jamaan Abdulmajeed-Jamaan commented Mar 11, 2026

Description

Spatie Media Library provides image generators that create derived image files from media (e.g., generating thumbnails from uploaded PDFs). However, the current FileUpload component does not support using different URLs for the preview image and the open/download button.

Introduce server-provided openable/downloadable URLs in uploaded file metadata and use them for the file open action by utilizing FilePond Metadata object.

This enables customizable/signed URLs or alternate domains for opening/downloading uploaded files.

Visual changes

None

Functional changes

JS: add uploadedFile.metadata to the file options and prefer metadata.openableUrl (falling back to file.source) when generating the open link, the same for downloadable.

PHP: introduce a getOpenableUrlUsing closure property and setter, and populate metadata.openableUrl for each stored file by evaluating the callback, the same for downloadable.

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

Abdulmajeed-Jamaan and others added 6 commits March 11, 2026 23:00
Include server-provided openable URLs in uploaded file metadata and use them for the file open action. JS: add uploadedFile.metadata to the file options and prefer metadata.openableUrl (falling back to file.source) when generating the open link. PHP: introduce a getOpenableUrlUsing closure property and setter, and populate metadata.openableUrl for each stored file by evaluating the callback. This enables customizable/signed URLs or alternate domains for opening uploaded files.
Support custom downloadable URLs for uploaded files. Backend: add a getDownloadableUrlUsing callback and property on BaseFileUpload, populate metadata.downloadableUrl when isDownloadable() and the callback is set, and ensure openable URL generation checks isOpenable(). Frontend: prefer metadata.downloadableUrl for the download anchor href (fallback to file.source behavior removed). This enables serving custom download links separate from the file source.
Remove an extra blank line and standardize conditional formatting in BaseFileUpload: add consistent spacing and braces for the openable/downloadable URL checks and tidy up the getDownloadableUrlUsing method. Purely stylistic changes with no functional impact.
@github-project-automation github-project-automation bot moved this to Todo in Roadmap Mar 11, 2026
@Abdulmajeed-Jamaan Abdulmajeed-Jamaan changed the title Feat: Add openableUrl support for file uploads Feat: Add custom openable/downloadable Urls support for file uploads Mar 11, 2026
@Abdulmajeed-Jamaan Abdulmajeed-Jamaan changed the title Feat: Add custom openable/downloadable Urls support for file uploads Feat: Add custom openable/downloadable URLs support for file uploads Mar 11, 2026
@danharrin danharrin added enhancement New feature or request pending review labels Mar 12, 2026
@danharrin danharrin added this to the v4 milestone Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pending review

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants