I think that your problem in this line:
header("Content-Disposition: filename=$file" . "%20");
I don't know what that %20 is for and you should quote the filename,
that line should be something like this:
header("Content-Disposition: attachment; filename=\"$file\"");
Considering that $filename already has the 7z extension.
Jonathan
On Sun, Sep 6, 2009 at 3:19 PM, Chris Payne<[email protected]> wrote:
> Hi Everyone,
>
> I've setup a filedownload which works but i'm having an issue, i've
> left out but when it downloads it, while it has the correct file it
> doesn't have a file extension associated with it, I need the .7z
> extension associated with the filename, can anyone see why that would
> do this below?
>
> I'm sure it's something obvious but i'm new to doing file downloads.
>
> Thank you everyone
>
> Chris
>
> $file = "SOMEFILE.7Z";
> $speed = 60; // i.e. 60 kb/s download rate
> if(file_exists($file) && is_file($file)) {
> header("Cache-control: private");
> header("Content-Type: application/octet-stream");
> header("Content-Length: ".filesize($file));
> header("Content-Disposition: filename=$file" . "%20");
> flush();
> $fd = fopen($file, "r");
> while(!feof($fd)) {
> echo fread($fd, round($speed*1024)); // $speed kb at a time
> flush();
> sleep(1);
> }
> fclose ($fd);
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php