eZ Community » Forums » Setup & design » How to get the size of a remote file?
expandshrink

How to get the size of a remote file?

How to get the size of a remote file?

Friday 10 December 2010 7:51:55 pm - 4 replies

Hi there,

I'm looking for a way (template operator) to retrieve the size of a remote file. I have the full URL of the file in a text line attribute and I want to create a link in the template to the file. Works nice. Now, i want to display the (remote) file size next to the link.

How can this be done? I did not find a template operator for this yet. Although, there does not seem to exist a PHP function for this. I thought, i could use "filesize" for this (http://php.net/manual/de/function.filesize.php ) and use it throught PHPOperatorList , but this is only intended for local files.

Any idea?

Friday 10 December 2010 8:24:52 pm

Maybe you can have a look at some of the comments to filesize function and do a function working like that.

have a look at

http://www.php.net/manual/en/function.filesize.php#92462

Monday 13 December 2010 9:56:11 am

Hi there,

I'm looking for a way (template operator) to retrieve the size of a remote file. I have the full URL of the file in a text line attribute and I want to create a link in the template to the file. Works nice. Now, i want to display the (remote) file size next to the link.

How can this be done? I did not find a template operator for this yet. Although, there does not seem to exist a PHP function for this. I thought, i could use "filesize" for this (http://php.net/manual/de/function.filesize.php ) and use it throught PHPOperatorList , but this is only intended for local files.

Any idea?

Try it with curl. E.g.. http://snipplr.com/view/29/get-remote-filesize/

Tuesday 14 December 2010 10:47:55 pm

Thanks for your replies.

So, i read, that currently, there is no built-in or otherwise "easy-to-get" option for this. One would need to write a (simple) template operator for it, right?

Wednesday 15 December 2010 9:31:33 am

Thanks for your replies.

So, i read, that currently, there is no built-in or otherwise "easy-to-get" option for this. One would need to write a (simple) template operator for it, right?

In short, yes happy.gif Emoticon

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from