Re: FW: looking for two remote functions
| From: | Tijnema ! | Date: | Tue, 13 Mar 2007 15:18:10 +0000 |
| Subject: | Re: FW: looking for two remote functions | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250441@lists.php.net to get a copy of this message | ||
Can you maybe explain why you want the exact size on the disk in blocks??
do you care if it differs 1KB?? what are you planning to write, the actual
filesize on the disk can only differ 1 block with real filesize, and so if
the blocksize is 1024bytes, it differes a max of 1024bytes...
And btw, the size it takes on your server in blocks might be different then
the size it takes on the server's disk...
I'm not totally sure how a hdd works, but i know it is split up in blocks,
and so you need to know the blocksize on the partition you are going to
place the file, using different filesystems on 1 system can mean that a file
is bigger/smaller on the same system.
So the way to calculate the block filesize would be by getting the real
filesize, and then round it until $filesize%$blocksize == 0
So, in PHP code it would like this.
$blocksize = 1024; // Default on Ext2/3 i believe
$filesize = filesize("http://server.com/file.rar");
while($filesize%$blocksize != 0)
{
$filesize += 1;
}
I'm not sure if it's the size you were looking for, but keep in mind that it
depends on the block size. So different filesystems use different block
size.
Tijnema
On 3/13/07, Richard Lynch <ceo@l-i-e.com> wrote:
If PHP is returning that goofy Windows 'size on disk' number, I want to see your script... Because, no, I don't think it does that... On Sat, March 10, 2007 4:42 am, Riyadh S. Alshaeiq wrote: Actually if right click on any file or folder on a machine you will see that there are two values (Size on disk & Size). Files and folders are stored on the disk in what is called clusters (a group of disk sectors). Size on disk refers to the amount of cluster allocation a file is taking up, compared to file size which is an actual byte count. As I mentioned before what I want is a function for getting the result for the Size no for Size on Disk Riyadh -----Original Message----- From: Németh Zolt?n [mailto:znemeth@alterationx.hu] Sent: 10/Mar/2007 12:27 PM To: Riyadh S. Alshaeiq Cc: php-general@lists.php.net Subject: Re: [PHP] FW: looking for two remote functions I'm afraid I don't understand what you want. The size of a file is its size in bytes, that is its size on the disk. So what else? greets Zolt?n Németh 2007. 03. 10, szombat keltezéssel 06.07-kor Riyadh S. Alshaeiq ezt ?rta:postedThank you Mickey, but I have already looked in there and the functionneedin the notes is working just fine for getting the size on disk which I am not interested in.. Riyadh -----Original Message----- From: Mikey [mailto:frak@upcore.net] Sent: 9/Mar/2007 2:57 PM To: php-general@lists.php.net Subject: Re: looking for two remote functions Riyadh S. Alshaeiq wrote:Hello everybody, I am looking for an HTTP function for getting remote filesizes.Keeping inmind that I am NOT interested in getting the "size on disk"figure, Ithe actual size of the files when downloaded to a local machine.-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpPlease letme know if there are any.. Another thing, I also need a remote function that gets the createddate andlast modified separately, if possible.. Best regardsTry looking here: http://uk.php.net/manual/en/function.filesize.php If the function itself isn't of use to you, look further down in the notes and I am sure you will find something useful. Mikey