S
Seansan
Hi there,
Does anyone know why the following code doenst force a download of a m3u
list (winamp playlist) when called directly? Am I forgetting something?
regards, Seansan
my $mp3_dir = '/var/www/html/dl';
my $url_root = 'http://www.site.com/dl/';
my $body;
opendir(D, $mp3_dir);
my @f = readdir(D);
closedir(D);
foreach my $file (@f) {
next if ($file eq '.' || $file eq '..');
next if (-d $file);
if ($file =~ /mp3$/) {
$body .= $url_root . $file . "\n";
}
}
print "Content-type: application/octet-stream\n";
print "Content-Disposition: attachment; filename=mymusic.m3u\n";
print "Content-Length: ", length $body, "\n\n",
print $body;
Does anyone know why the following code doenst force a download of a m3u
list (winamp playlist) when called directly? Am I forgetting something?
regards, Seansan
my $mp3_dir = '/var/www/html/dl';
my $url_root = 'http://www.site.com/dl/';
my $body;
opendir(D, $mp3_dir);
my @f = readdir(D);
closedir(D);
foreach my $file (@f) {
next if ($file eq '.' || $file eq '..');
next if (-d $file);
if ($file =~ /mp3$/) {
$body .= $url_root . $file . "\n";
}
}
print "Content-type: application/octet-stream\n";
print "Content-Disposition: attachment; filename=mymusic.m3u\n";
print "Content-Length: ", length $body, "\n\n",
print $body;