Downloading

Discussion in 'HTML' started by Sheldon Glickler, Jan 7, 2008.

  1. 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
     
    Sheldon Glickler, Jan 7, 2008
    #1
    1. Advertising

  2. Sheldon Glickler wrote:
    > 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?
     
    Harlan Messinger, Jan 7, 2008
    #2
    1. Advertising

  3. Harlan Messinger wrote:
    > Sheldon Glickler wrote:
    >> 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.


    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.....

    >
    >> 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?


    I am not the user.

    >
    > > 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?


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

    --
    Shelly
     
    Sheldon Glickler, Jan 7, 2008
    #3
  4. Sheldon Glickler wrote:
    > Harlan Messinger wrote:
    >> Sheldon Glickler wrote:
    >>> 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.

    >
    > 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.
     
    Harlan Messinger, Jan 7, 2008
    #4
  5. Sheldon Glickler

    Jeff Guest

    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
    > Harlan Messinger wrote:
    >> Sheldon Glickler wrote:
    >>> 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.

    >
    > 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.....
    >
    >>
    >>> 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?

    >
    > I am not the user.
    >
    >>
    >> > 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?

    >
    > That is what the customer spec called for -- and he is paying the bill.
    >
     
    Jeff, Jan 7, 2008
    #5
  6. Sheldon Glickler

    rf Guest

    "Sheldon Glickler" <> wrote in message
    news:...
    > Harlan Messinger wrote:
    >> Sheldon Glickler wrote:


    >> > 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?

    >
    > 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.

    --
    Richard.
     
    rf, Jan 8, 2008
    #6
  7. Harlan Messinger wrote:
    > Sheldon Glickler wrote:
    >> Harlan Messinger wrote:
    >>> Sheldon Glickler wrote:
    >>>> 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.

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


    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?
     
    Sheldon Glickler, Jan 8, 2008
    #7
  8. rf wrote:
    > "Sheldon Glickler" <> wrote in message
    > news:...
    >> Harlan Messinger wrote:
    >>> Sheldon Glickler wrote:

    >
    >>> > 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?

    >> 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.


    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.
     
    Sheldon Glickler, Jan 8, 2008
    #8
  9. Jeff wrote:
    > 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




    > Jeff
    >> Harlan Messinger wrote:
    >>> Sheldon Glickler wrote:
    >>>> 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.

    >>
    >> 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.....
    >>
    >>>
    >>>> 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?

    >>
    >> I am not the user.
    >>
    >>>
    >>> > 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?

    >>
    >> That is what the customer spec called for -- and he is paying the bill.
    >>
     
    Sheldon Glickler, Jan 8, 2008
    #9
  10. Sheldon Glickler

    Bergamot Guest

    Sheldon Glickler wrote:
    >
    > 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.

    --
    Berg
     
    Bergamot, Jan 8, 2008
    #10
  11. Sheldon Glickler

    sheldonlg Guest

    Bergamot wrote:
    > Sheldon Glickler wrote:
    >> 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.
    >


    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.

    --
    Shelly
     
    sheldonlg, Jan 8, 2008
    #11
  12. Sheldon Glickler wrote:
    > Harlan Messinger wrote:
    >> Sheldon Glickler wrote:
    >>> Harlan Messinger wrote:
    >>>> Sheldon Glickler wrote:
    >>>>> 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.
    >>>
    >>> 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

    >
    > 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?
    >


    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
     
    Harlan Messinger, Jan 8, 2008
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ian Gordon

    Downloading a file...

    Ian Gordon, Jul 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    949
    Ian Gordon
    Jul 30, 2003
  2. Chris Morrison

    Downloading a file from a website

    Chris Morrison, Dec 18, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    509
    Vijayakrishna Pondala
    Dec 31, 2003
  3. Replies:
    0
    Views:
    409
  4. Isaac

    Downloading into XCV600

    Isaac, Jul 31, 2003, in forum: VHDL
    Replies:
    0
    Views:
    994
    Isaac
    Jul 31, 2003
  5. Jack Schafer
    Replies:
    1
    Views:
    535
    Joe Smith
    Apr 23, 2004
Loading...

Share This Page