RE: File download question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That is for IE and its silly FileName[N] rather than FileName

here a good old function to download:
http://www.devpro.it/code/72.html

Regards

> Date: Sun, 6 Sep 2009 15:43:27 -0300
> From: tapicer@xxxxxxxxx
> To: chris_payne@xxxxxxxxxxxxxxx
> CC: php-general@xxxxxxxxxxxxx
> Subject: Re:  File download question
> 
> 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<chris_payne@xxxxxxxxxxxxxxx> 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
> 

_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux