Downloading

  • Thread starter Sheldon Glickler
  • Start date
S

Sheldon Glickler

I want to be able to download a file. If the file is a zip or an exe,
the user is asked where to save the file and the download proceeds.
However, if the file is a pdf, the pdf displays and doesn't bring up the
save as box.

I do not want the pdf to display. Rather, I want to have it bring up
the save as box. i do not want to first zip up the pdf and force the
user to unzip it.

Is this possible?
If so, how is this done?

I did Google searches for "download pdf file" and "download pdf file
'save as'" but they didn't reveal any answers.

Shelly
 
H

Harlan Messinger

Sheldon said:
I want to be able to download a file. If the file is a zip or an exe,
the user is asked where to save the file


I'm confused. First you say that *you* want to be able to download a
file, and then you imply that you're talking about someone else.
and the download proceeds.
However, if the file is a pdf, the pdf displays and doesn't bring up the
save as box.

I do not want the pdf to display.

If you're the user, then right-click the link (assuming IE or Firefox on
Windows) and choose the option to save the link to your computer. If you
aren't the user, then who are you to decide that the user wants to
download the PDF to his hard drive?
> Rather, I want to have it bring up
the save as box. i do not want to first zip up the pdf and force the
user to unzip it.

Why do you want to force the user to do anything except use his browser
in the way in which he's accustomed to using it?
 
S

Sheldon Glickler

Harlan said:
I'm confused. First you say that *you* want to be able to download a
file, and then you imply that you're talking about someone else.

The customer wants to limit the number of downloads and he doesn't want
the pdf to display to the user. He wants the user to display it on his
own after he has downloaded it. I know this is silly since once the
user has downloaded the file, he can always copy it to any number of
machines, but the customer IS the customer.....
If you're the user, then right-click the link (assuming IE or Firefox on
Windows) and choose the option to save the link to your computer. If you
aren't the user, then who are you to decide that the user wants to
download the PDF to his hard drive?

I am not the user.
Why do you want to force the user to do anything except use his browser
in the way in which he's accustomed to using it?

That is what the customer spec called for -- and he is paying the bill.
 
H

Harlan Messinger

Sheldon said:
The customer wants to limit the number of downloads and he doesn't want
the pdf to display to the user. He wants the user to display it on his
own after he has downloaded it. I know this is silly since once the
user has downloaded the file, he can always copy it to any number of
machines, but the customer IS the customer.....

If site is for use by the customer's employees, then the customer can
have the employees' browsers configured to prompt the user. If it's for
your customer's customers, it isn't any of *his* business and it doesn't
make any sense anyway. Have you tried discussing this with your
customer? Maybe you have, but I'm always surprised by the number of
people who assume outright that customers never want to hear advice and
feedback from the knowledgable people performing work for them. A
constructive approach is not to criticize the instructions but to point
out likely *consequences* that "you may not have thought about", including:

* consequences that may be undesirable
* consequences that will be at odds with other stated
purposes of the customer himself
* consequences that will eliminate any perceived benefit
* the consequence that the requested feature won't actually
have the effect that the customer assumed it would
have when he requested it, which means he'll be
spending money for nothing

I haven't always convinced the customer by following this approach, but:

* it has often helped clarify things
for customers that weren't
previously clear to them,
* I have often directed customers
to solutions that they like better
than the ones they had conceived
for themselves,
* I have often gotten a better understanding
of why they requested *their* approach,
which helped me do a better job of
fulfilling the request OR of making an
even *better* counter-suggestion,
* I have usually gotten credit for being
helpful and attentive--the customers
have liked knowing that I'm paying
attention, and
* the response has never been "How dare you
question me?" and has rarely been even
milder form of that retort.

In your case, has your customer considered the possibility that not all
his users will be able to find a file after having downloaded it? What
is their level of sophistication?

It isn't clear to *me* how prompting the user to save the files will
have the effect of limiting the number that they download. Is it clear
to you? Anyway, the way to accomplish that is by linking to a
pass-through routine rather than to the documents themselves, one that
keeps either a session counter (if the limit is per-session) or a
database-based counter (if the limit is per authenticated user) and
checks it before feeding the content of the document to the user.
 
J

Jeff

Sheldon Glickler wrote:

Tinker with the Content-disposition you send, change it to attachment.

I suppose you could also change the content-type so the users
computer wouldn't know what to do with and would be forced to save.

Try the content-disposition first, as it is the correct way to do that.

Jeff
 
R

rf

Sheldon Glickler said:
That is what the customer spec called for -- and he is paying the bill.

Then you must tell the customer that whatever the spec calls for it still
has no control over what the users browser does.
 
S

Sheldon Glickler

Harlan said:
If site is for use by the customer's employees, then the customer can
have the employees' browsers configured to prompt the user. If it's for
your customer's customers, it isn't any of *his* business and it doesn't
make any sense anyway. Have you tried discussing this with your
customer? Maybe you have, but I'm always surprised by the number of

I had already passed on this information to my bossthat the customer's
request is silly. He said he had talked with them, but that is what
they wanted.
people who assume outright that customers never want to hear advice and
feedback from the knowledgable people performing work for them. A
constructive approach is not to criticize the instructions but to point
out likely *consequences* that "you may not have thought about", including:

* consequences that may be undesirable
* consequences that will be at odds with other stated
purposes of the customer himself
* consequences that will eliminate any perceived benefit
* the consequence that the requested feature won't actually
have the effect that the customer assumed it would
have when he requested it, which means he'll be
spending money for nothing

I haven't always convinced the customer by following this approach, but:

* it has often helped clarify things
for customers that weren't
previously clear to them,
* I have often directed customers
to solutions that they like better
than the ones they had conceived
for themselves,
* I have often gotten a better understanding
of why they requested *their* approach,
which helped me do a better job of
fulfilling the request OR of making an
even *better* counter-suggestion,
* I have usually gotten credit for being
helpful and attentive--the customers
have liked knowing that I'm paying
attention, and
* the response has never been "How dare you
question me?" and has rarely been even
milder form of that retort.

In your case, has your customer considered the possibility that not all
his users will be able to find a file after having downloaded it? What
is their level of sophistication?

It isn't clear to *me* how prompting the user to save the files will
have the effect of limiting the number that they download. Is it clear
to you? Anyway, the way to accomplish that is by linking to a
pass-through routine rather than to the documents themselves, one that
keeps either a session counter (if the limit is per-session) or a
database-based counter (if the limit is per authenticated user) and
checks it before feeding the content of the document to the user.

Can you explain this "pass-through" routine?
 
S

Sheldon Glickler

rf said:
Then you must tell the customer that whatever the spec calls for it still
has no control over what the users browser does.

More to the point, once the user downloads the file even ONCE, he can
copy it to as many machines as he wants, email to whomever he wants,
make a CD and give it away, etc. My customer has NO control over that,
but he still insists.
 
S

Sheldon Glickler

Jeff said:
Sheldon Glickler wrote:

Tinker with the Content-disposition you send, change it to attachment.

I suppose you could also change the content-type so the users computer
wouldn't know what to do with and would be forced to save.

Try the content-disposition first, as it is the correct way to do that.

Thanks for the suggestion. I googled and found
http://support.microsoft.com/kb/260519
which says:

You can use the content-disposition header to override this default
behavior. Its format is:
Content-disposition: attachment; filename=fname.ext
 
B

Bergamot

Sheldon said:
The customer wants to limit the number of downloads and he doesn't want
the pdf to display to the user.

As soon as the visitor clicks the link it's going to be downloaded,
whether it automatically opens with a pdf reader or not. There's no
difference in the number of downloads here, so there is no limiting
involved.

If the customer really wants to limit the number of downloads, require
user registration before they even see a link to the file. That will
discourage arbitrary downloads by casual surfers.
 
S

sheldonlg

Bergamot said:
As soon as the visitor clicks the link it's going to be downloaded,
whether it automatically opens with a pdf reader or not. There's no
difference in the number of downloads here, so there is no limiting
involved.

If the customer really wants to limit the number of downloads, require
user registration before they even see a link to the file. That will
discourage arbitrary downloads by casual surfers.

This, I have already handled. The user buys the manual and is given a
randomly generated, eight character (from among the 62) key. To get at
the file, he will have to click on the download page after entering the
key. I then check the key and the product_id, drop the available number
of downloads, and offer the download.
 
H

Harlan Messinger

Sheldon said:
I had already passed on this information to my bossthat the customer's
request is silly. He said he had talked with them, but that is what
they wanted.


Can you explain this "pass-through" routine?

For example, instead of

<a href="this.pdf">This</a>

you'd have

<a href="deliver_pdf?pdf=this">This</a>

The file deliver_pdf (or the file it refers to if it's aliased by the
web server) will have server-side code that does more less the following
(in extreme pseudo-code):

limit = [number of downloads permitted]
soFar = [number of downloads so far]
if (soFar >= limit)
set Response.ContentType to "text/html"
send web content that includes a message,
"Sorry, you've reached your download limit"
else
set Response.ContentType to "application/pdf"
open this.pdf as a LOCAL BINARY FILE that isn't on the website
binary-read the contents of this.pdf
binary-write the contents to the Response object
close this.pdf
increase the stored number of downloads so far by 1
end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top