PDA

View Full Version : predict final file size of a php file??


colfaxrev
10-27-2006, 09:20 PM
look at this link

http://triotalentagency.com/newsite/tracking.php?action=show

in flash when im trying to make a preloader, the final size is undefined, because its not done making the data i guess.

anyway, i wanted to make a separate php file that simply got the final file size. so that I could use it for the preloader.

This size will be changing from time to time, so i need it to be dynamic..

i tried some silly stuff like...


print "filesize[" . filesize("tracking.php?action=show") . "]";
//and
print "filesize[" . filesize(readfile("tracking.php?action=show")) . "]";


both printed this...


filesize[]


does anyone know a way to do this?

peptobismol
10-28-2006, 05:52 AM
a file size to http://triotalentagency.com/newsite/...hp?action=show???
it's way less than 1k. why bother with a preloader unless you're on one of those 1200 baud modem from the '80s

colfaxrev
10-28-2006, 08:22 AM
you must have looked at it when i dumped the data

it can be up to 6MB

peptobismol
10-28-2006, 07:21 PM
i see. just use LoadVars to http://triotalentagency.com/newsite/...action=show


there a LoadVars.getBytesTotal() ...
intitially it will be undefine but it'll give the correct size.

ps.. there might be a limit to how much you can import data into flash. it's been a while since i tested this but eventually it'll take too much ram and the flash player will crash & quit.

jsebrech
10-30-2006, 09:53 AM
Use an output buffer (http://www.php.net/outcontrol) in your PHP script, activated with a special get argument. You can measure the bytesize of the output buffer, discard the buffer and only output the filesize. You can also use gzip compression with the gz output handler on the output buffer to dramatically reduce the filesize of most files.