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

date posted 16th January 2008 07:40

> -----Original Message-----
> Steven Lavine wrote:
> >
> > Hi Guys,
> >
> > I hope you all had a great christmas and new year.
> > I'm having a slight problem with a PHP download script that I am
> > helping a client with.
> > When an image file is downloaded, it is corrupted. All other files
> are
> > fine, it is just image files. The client has a large number of jpeg
> > files that they charge customers for, so jpegs cannot be corrupted.
> > Any ideas, as I'm stumped. Here is a snippet of code that dowloads
> the
> > file.
> >
> > header("Content-Transfer-Encoding: Binary");
> > header('Content-Type: application/octet-stream;
> > name=3D"'.basename($filename).'"');
> > header("Cache-Control: must-revalidate, post-check=3D0, =
pre-check=3D0");
> > $date =3D date("D, d M Y H:i:s T");
> > header("Last-Modified: $date");
> > header("Expires: 0");
> > header("Accept-Ranges: bytes");
> > header("Content-Length: ".filesize($filename));
> > header('Content-Disposition: attachment;
> > filename=3D"'.basename($filename).'"');
> > header("Content-Description: File Transfer");
> >
> >
> > Best Regards,
> >
> > Steven
> >
> Thanks every one who has helped. None of the above has worked, I've
> tried setting the content-type to jpeg, using the mime type as the =
same
> script is run if it is a jpeg, png, pdf, mp3 etc, everything other =
than
> an image works perfectly though.
>=20
> Steve
>=20

What would happen if you renamed a .jpg to say .pdf and did the download =
using the script above and then renamed it back to .jpg, is the jpg =
still corrupt? I'm just trying to ascertain if it is something specific =
to it having a jpeg extension or the jpeg data that=E2=80=99s at fault.

Alternatively you could zip up the images and have them download as a =
zip instead; we do this for one of our photo sites.

Also test on a separate server in case it=E2=80=99s a problem specific =
to the server.

Regards=20
Sam Morgan=20
--=20
WiredEyes Media / ServWise Advanced Hosting

tel (Uk): +44 (0)20 7100 2178
tel (Italy): +39 070 773 6543
web : www.wiredeyes.com / www.servwise.com
umop ap!sdn w,! aw dlaH
--=20
=E2=98=85=E2=98=85 Hosting from 63p per month using coupon : HALFPRICE
=E2=98=85=E2=98=85 Domain Names from =C2=A33.89/y & 128bit SSL =
Certificates only =C2=A38.00/y





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
October 2008
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