[wplug] Apache question
Joe Topjian
joe at portsys.net
Tue Sep 9 11:04:51 EDT 2003
> If there a way to determine when "the file is done downloading"
> whereas PHP could then issue a command?
This worked for images.. didnt try it on movies or music:
<?php
$connections = `cat counter.txt`;
if ($connections < 3) {
$connections += 1;
system("echo $connections > counter.txt");
$fh = fopen('image.jpg', 'r');
header("Content-type: image/jpeg");
if ($fh) {
$content = fread($fh, filesize('image.jpg'));
echo $content;
}
fclose($fh);
$connections -= 1;
system("echo $connections > counter.txt");
}
?>
Of course, you might want to implement file opening and file locking
when reading from the counter file to avoid collisions.
You can also find a list of content types to use here:
http://www.isi.edu/in-notes/iana/assignments/media-types/media-types
Depending on what format you're going to use.
Lemme know if this helps :)
---
Joe Topjian
email: joe at portsys.net
web: http://zaven.us
More information about the wplug
mailing list