UniSharp/laravel-filemanager

Callbacks more properties of the file

B-MNSN opened this issue · 1 comments

I need the size of the file when confirm in filemaneger.

this my current callback

window.setURL = function(items) {
     items.icon
     items.is_file
     items.is_image
     items.name
     items.thumburl 
     items.time
     item.URL 
}

How get the size of file

You can achieve this by modifying config/lfm.php.

Change from:

'item_columns' => ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url'],

to below:

'item_columns' => ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url', 'size'],

Then in you code block, you can iterate through items and get file size like:

window.setURL = function(items) {
    items.forEach((item) => {
        console.log(item.size)
    }
}