Original filename of uploaded file to image/file fields is not kept #6785
Replies: 3 comments
-
Related Keystone Community Slack thread - https://keystonejs.slack.com/archives/C01STDMEW3S/p1632389826435700 |
Beta Was this translation helpful? Give feedback.
-
@MurzNN I'm moving this to our feature request list, as it's not so much a bug, but an enhancement to Keystone. |
Beta Was this translation helpful? Give feedback.
-
Hi folks. We have this same need. We ideally need to save original filenames in our database because we bulk upload large amounts of images and in some cases need to be able to sort our image query results based on the image’s original filename. It’s fine that the final saved file gets a random ID as its new filename, but I need to at least have access to the original filename somewhere in the upload/save flow. That said, I’m wondering what the recommended approach would be for that since the filename doesn’t appear to leave the client side when uploading to the server. Do I need to create a custom UI component to handle something like this? Or is there possibly a way to do this with resolver hooks? Any current recommendation would be greatly appreciated! Also happy to contribute back to the project if this is something that needs to be updated internally. Also, I’m aware this was discussed in Slack (as noted above), but that Slack history is no longer available and I'm wondering if someone could share what was discussed there (if anyone remembers). Would be useful to have a little more historical context while I'm digging into this. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Bug report
Describe the bug
When file is uploaded to Keystone item, file name are regenerated:
For images it becomes as uuid like this:
7bcf91af-14f2-4cca-98b1-f8c1b0c593e7.jpg
For files - the unique suffix is added, like this:
original-file-name-2y8Q9jrq0mGxW7DE1.pdf
And there is no information in database are stored about original filename of uploaded file!
To Reproduce
Expected behaviour
File name should be stored at least in database as some field, even if we store the file in directory using uniqueized filename!
And we should show it in Admin UI instead of generated one.
System information
Beta Was this translation helpful? Give feedback.
All reactions