Display upload file size in kb in collection list view

default discord avatar
chaitealattayy
4 months ago
2

I am trying to display the file size for my media collection in kb. I tried adding a function to transform the bytes that

filesize

returns to kb, but

defaultColumns

only allows for strings and I am not sure where to access the raw filesize data itself to transform.



  defaultColumns: ['filename', 'alt', 'width', 'height', 'filesize' ]


Is there any way to display this in the collection list view? I see the file size displayed as kb in the individual media view, but can't find where to access that for

defaultColumns

.

  • discord user avatar
    dribbens
    Payload Team
    4 months ago

    Since you pointed out that it is in other places, this should be considered a bug. The file sizes should be displayed consistently in kb.



    I would make an issue, it will be a very quick change to make.

  • default discord avatar
    chaitealattayy
    4 months ago

    @dribbens I opened one, thank you!


    https://github.com/payloadcms/payload/issues/2727
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.