Repository navigation
Renaming Uploads #12244
damnsamn
started this conversation in
Feature Requests & Ideas
Renaming Uploads
#12244
Replies: 1 comment
|
It would be great if we could have this as a built-in functionality. But as we don't have this yet, here is a workaround using Google Cloud Storage as an example. In your before change hook - in my case I need to perform the rename here// choose your auth method, this is just a simple working example.
const storage = new Storage({
apiEndpoint: "<api endpoint>",
projectId: "<project id>",
credentials: {
client_email: "<client email>",
private_key: "<private key>",
},
});
const bucket = storage.bucket("<bucket name>");
await bucker.move("old/object/name", "new/object/name");Pitfalls: If you have multi-tenancy using payload's Multi-Tenant Plugin, you will need to check permissions, of course. In a scenario, a Media tenant can be changed, which may result in changing the directory where you store tenant-specific media.. Sources: |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
At the moment it feels a bit unintuitive to not be able to rename an upload. The current workaround to get this done is to remove the file and re-upload a new one with the intended name in the same document - but we've had clients resistant to this idea.
I’m currently just thinking I’ll add a
titlefield that just defaults to the filename’s value to work as a display name, but this introduces complexities in needing to override all the uploads-specific components to surface the title field alongside the thumbnail rather than the filename field. Is there a technical reason we should avoid changing the actual filename field (I would assume the case of local file storage would be the key constraint here). Is there the potential to be able to rename uploads in future?All reactions