For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2006 > file download is php script (to be able to log) but doesn't always appear to work ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author file download is php script (to be able to log) but doesn't always appear to work ?
Peter

2005-12-03, 6:55 pm

Hi,

I have a couple of download links on my site but they are in fact links to a
php script.
I dynamically construct a url to the file based on script input and/or a
randomizer to be able to spread the download over multiple locations etc.

At the end of the script I do this :

header("Location: $newurl"); // re-direct

The $newurl is then for instance http://www.location1/file1.zip

I have logged many thousands of (suposedly) successful downloads but once in
a while I get an email from somebody who claims download doesn't work from
all links. When I then try I have no problem at all.
This has not happened once, of course not everybody will do the effort to
write an email. Say once every 50.000 (logged) downloads (probably less)

Q.
1. Do you think this could be due to bandwidth issues sometimes ? Although
these people usually claim the website itself works ok and fast enough ?
2. Or do you think that the header() call is not always OK ? I have no
issues with IE and FireFox and yet usually these claims come from people
using either IE or Firefox as well.
3. Or something else altogether ?


Jim Michaels

2006-01-18, 7:56 am

in other posts you will find that there are other headers you need to
include for a file download.
http://www.iana.org/assignments/med...application/zip
http://support.microsoft.com/kb/q279667/
http://www.ietf.org/rfc/rfc2183.txt
http://www.phpbuilder.com/board/pri....php?t=10210843
header("Content-Type: application/download"); // or application/x-download,
or application/zip
header("Content-Disposition = attachment; filename=file1.zip");
it won't work with a URL. not according to RFC2183 (content-disposition
usage). the filename specified is the filename that the user gets on their
side if I am correct.

I have tried opening a new window with a zip file as the address and getting
a screen full of garbage instead of a download, so I don't quite know how
that will work.
try downloading wget and extracting one of the links from a mirror site and
see what they use for headers. I don't know if wget will allow you to get
headers or not.
I know of another, manual technique if you don't have packet sniffer
software, to look at headers.
I really suspect (from the research I've done so far) that there isn't a way
unless you've set up the other web sites as mirror sites.

"Peter" <Will_Bounce_So_Use_My_First_Name@Smart-Projects.net> wrote in
message news:5vkkf.63679$j_1.3932252@phobos.telenet-ops.be...
> Hi,
>
> I have a couple of download links on my site but they are in fact links to
> a php script.
> I dynamically construct a url to the file based on script input and/or a
> randomizer to be able to spread the download over multiple locations etc.
>
> At the end of the script I do this :
>
> header("Location: $newurl"); // re-direct
>
> The $newurl is then for instance http://www.location1/file1.zip
>
> I have logged many thousands of (suposedly) successful downloads but once
> in a while I get an email from somebody who claims download doesn't work
> from all links. When I then try I have no problem at all.
> This has not happened once, of course not everybody will do the effort to
> write an email. Say once every 50.000 (logged) downloads (probably less)
>
> Q.
> 1. Do you think this could be due to bandwidth issues sometimes ?
> Although these people usually claim the website itself works ok and fast
> enough ?
> 2. Or do you think that the header() call is not always OK ? I have no
> issues with IE and FireFox and yet usually these claims come from people
> using either IE or Firefox as well.
> 3. Or something else altogether ?
>
>



Peter

2006-01-18, 7:56 am

Hi,
[color=darkred]
a screen full of garbage instead of a download, so I don't quite know how
that will work.

It DOES seem to work however. The bulk of users is not complaining and it
has been a long while since somebody claimed he/she couldn't download.
It figure it will work for most always but maybe there are a few exceptions
?


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com