HTML5 Data Bindings Formatter Support Product Page

How can I display the size of a file?

11 years ago Andre Bender posted:
How can I display the size of a file when I'm using the HTML5 Data Bindings (Formatter)?

I'm currently using a function like this:
        
<?php
$filepath = "../".$row_rsFiles['Filename'];
echo round_file_size(filesize($filepath)); 
?>


Replies

Replied 11 years ago
11 years ago Andre Bender replied:
Any ideas?
Replied 11 years ago
11 years ago Andre Bender replied:
Up
Replied 11 years ago
11 years ago Teodor Kuduschiev replied:
Hello,
This is currently not supported but you can try one of the following suggestions:
- You can create a php file that outputs valid json, then you can load it as a dataset and use it in html5 data bindings

- You can try using this inline like: {{<?php echo filesize($file) ?>.formatNumber()}}
Replied 11 years ago
11 years ago Andre Bender replied:
Hi Teodor.
I don't quite understand the 2nd suggestion. How or where do I define $file?
Replied 11 years ago
11 years ago Teodor Kuduschiev replied:
Hello,
It is just an example of how you can use your php code inline with the data bindings. As i described currently it is not possible to show the size only using the database connector/data bindings/formatter.
Replied 11 years ago
11 years ago Andre Bender replied:
I got that, but your inline code contains the {{}} for data binding and no content connected to the dataset. So I need to do something like $file={{File}}?

Reply to this topic