Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

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



Messages by Day
January 31st 2008
January 30th 2008
January 29th 2008
January 28th 2008
January 27th 2008
January 26th 2008
January 25th 2008
January 24th 2008
January 23rd 2008
January 22nd 2008
January 21st 2008
January 20th 2008
January 19th 2008
January 18th 2008
January 17th 2008
January 16th 2008
January 15th 2008
January 14th 2008
January 13th 2008
January 12th 2008
January 11th 2008
January 10th 2008
January 9th 2008
January 8th 2008
January 7th 2008
January 6th 2008
January 5th 2008
January 4th 2008
January 3rd 2008
January 2nd 2008
January 1st 2008


Messages by Month
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000