|
|
 |
Re: FN-FORUM: PHP download script part 2
date posted 28th January 2008 12:58
Steven Lavine wrote:
>
> Hi all,
>
> Many thanks for all your help on my last posting. I have tried
> everything that was suggested, but to no avail.
>
> I decided to go the compressed file route, my download script now
> compresses the file into a zip file. If I access the zip file via FTP,
> I can download the file and extract the contents without any problems.
> However whenever I download via the script I get the following error:
>
> [/home/steven/Desktop/BNK1.jpg.zip]
> End-of-central-directory signature not found. Either this file is not
> a zipfile, or it constitutes one disk of a multi-part archive. In the
> latter case the central directory and zipfile comment will be found on
> the last disk(s) of this archive.
> zipinfo: cannot find zipfile directory in one of
> /home/steven/Desktop/BNK1.jpg.zip or
> /home/steven/Desktop/BNK1.jpg.zip.zip, and cannot find
> /home/steven/Desktop/BNK1.jpg.zip.ZIP, period.
>
> (I'm using Archive Manager in Gnome)
>
> The download code is below.
>
> function download_file()
> {
> if ($this->options['inmemory'] == 0)
> {
> $this->error[] = "Can only use download_file() if archive
> is in memory. Redirect to file otherwise, it is faster.";
> return;
> }
> switch ($this->options['type'])
> {
> case "zip":
> header("Content-Type: application/zip");
> break;
> case "bzip":
> header("Content-Type: application/x-bzip2");
> break;
> case "gzip":
> header("Content-Type: application/x-gzip");
> break;
> case "tar":
> header("Content-Type: application/x-tar");
> }
> $header = "Content-Disposition: attachment; filename=\"";
> $header .= strstr($this->options['name'], "/") ?
> substr($this->options['name'], strrpos($this->options['name'], "/") +
> 1) : $this->options['name'];
> $header .= "\"";
> header($header);
> header("Content-Length: " . strlen($this->archive));
> header("Content-Transfer-Encoding: binary");
> header("Cache-Control: no-cache, must-revalidate, max-age=60");
> header("Expires: 0");
> print($this->archive);
> }
> }
>
> This is really doing my head in as approx 6 months ago the script was
> working, yet no changes had been made. I'm thinking that it could be
> the server as I have copied the code to my local server and it works
> flawlessly. The server is hosted by Teclan, does anybody know of any
> issues with them?
>
> Best Regards,
>
> Steve
>
Under further investigation, I opened the working zip file and the
broken file into Joe and on the broken file appeared.
\nPKCD\n
This is not being printed by my php script any where.
Steve
|
 |
|