How to give (put to browser) someone PDF document, with hidden path to document.

Discussion in 'Perl Misc' started by MAX, Dec 20, 2005.

  1. MAX

    MAX Guest

    How to give (put to browser) someone PDF document, with hidden path to
    document.
    If I use locate, user can see exact location of PDF document.
    Perl script work on Microsoft IIS server and that cud be problem if I wont
    to use password on folder.

    #!/usr/bin/perl
    #
    #
    # print "Content-type: text/html\n\n";
    $line="www.mladilist.com/down/a.pdf";
    print "Location: http://$line\n\n";
    # ---------------------------------------

    Is it possible to hide document(directory) with password, so that you can
    read it only from perl script.
    Tnx.

    Paul
    MAX, Dec 20, 2005
    #1
    1. Advertising

  2. MAX

    Ian Wilson Guest

    Re: How to give (put to browser) someone PDF document, with hiddenpath to document.

    MAX wrote:
    > How to give (put to browser) someone PDF document, with hidden path to
    > document.


    I'd have a CGI script, at an innocuous URL, read the file from the
    hidden path and print it to STDOUT after emitting the appropriate HTTP
    headers (e.g. 'Content-type: text/pdf' or whatever.) I recall there are
    modules that can assist with this.

    > If I use locate, user can see exact location of PDF document.


    Then I wouldn't if that is really important. I don't see why it could be
    important.

    > Perl script work on Microsoft IIS server and that cud be problem if I wont
    > to use password on folder.


    I think passwording folders would be best handled as an IIS problem not
    a Perl problem. I'd ask in an IIS newsgroup.

    >
    > #!/usr/bin/perl


    IIS?

    > #
    > #
    > # print "Content-type: text/html\n\n";
    > $line="www.mladilist.com/down/a.pdf";


    I'd use single quotes, include the 'http://' and name the variable $url.

    > print "Location: http://$line\n\n";


    I assume $line is also used elsewhere?

    > # ---------------------------------------


    Have you read the posting guidelines? use strict; use warnings; etc

    >
    > Is it possible to hide document(directory) with password, so that you can
    > read it only from perl script.


    Yes but that would be an IIS problem not a Perl problem. I'd ask in an
    IIS newsgroup.
    Ian Wilson, Dec 20, 2005
    #2
    1. Advertising

  3. MAX <> wrote:

    > How to give (put to browser) someone PDF document, with hidden path to
    > document.



    print() the appropriate headers to STDOUT
    open() the file
    binmode() the input and output filehandles
    readline() from the file and print() to STDOUT
    close() the file


    > Perl script work on Microsoft IIS server and that cud be problem if I wont
    > to use password on folder.



    If you tell us how that is a problem, then we might be able
    to help you solve it...


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Dec 20, 2005
    #3
  4. MAX

    Larry Guest

    Tad McClellan wrote:
    > MAX <> wrote:
    >
    > > How to give (put to browser) someone PDF document, with hidden path to
    > > document.

    >
    >
    > print() the appropriate headers to STDOUT
    > open() the file
    > binmode() the input and output filehandles
    > readline() from the file and print() to STDOUT
    > close() the file


    I would not recommend readline on a binary file. Use "read".
    Larry, Dec 21, 2005
    #4
  5. Larry <> wrote:
    > Tad McClellan wrote:
    >> MAX <> wrote:
    >>
    >> > How to give (put to browser) someone PDF document, with hidden path to
    >> > document.

    >>
    >>
    >> print() the appropriate headers to STDOUT
    >> open() the file
    >> binmode() the input and output filehandles
    >> readline() from the file and print() to STDOUT
    >> close() the file

    >
    > I would not recommend readline on a binary file. Use "read".



    Right. Thanks for the catch.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Dec 21, 2005
    #5
  6. MAX

    Guest

    Tad McClellan <> wrote:
    > MAX <> wrote:


    >> How to give (put to browser) someone PDF document, with hidden path to
    >> document.



    > print() the appropriate headers to STDOUT
    > open() the file
    > binmode() the input and output filehandles
    > readline() from the file and print() to STDOUT
    > close() the file


    I have never worked out how to pass the correct name of the file
    rather than the file being downloaded with the name of foo.pl
    but that is not a Perl question.

    Axel
    , Dec 21, 2005
    #6
  7. wrote

    > I have never worked out how to pass the correct name of the file
    > rather than the file being downloaded with the name of foo.pl
    > but that is not a Perl question.


    OT, but I think it was a Content-Disposition header like:
    Content-Disposition: attachment; filename=world-takeover.pdf

    hth, p

    --
    Better to reign in hell than to serve in heaven.
    -- John Milton, Paradise Lost
    Robert Sedlacek, Dec 21, 2005
    #7
  8. wrote in
    news:81bqf.12614$:

    > Tad McClellan <> wrote:
    >> MAX <> wrote:

    >
    >>> How to give (put to browser) someone PDF document, with hidden path
    >>> to document.

    >
    >
    >> print() the appropriate headers to STDOUT
    >> open() the file
    >> binmode() the input and output filehandles
    >> readline() from the file and print() to STDOUT
    >> close() the file

    >
    > I have never worked out how to pass the correct name of the file
    > rather than the file being downloaded with the name of foo.pl
    > but that is not a Perl question.


    I have not worked it out either, but

    <URL:http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1>

    See also:

    <URL:http://support.microsoft.com/kb/q279667/>

    <URL:http://support.microsoft.com/kb/q260519/>

    Hope this gives you a head start. I am sure someone over at
    comp.infosystems.www.authoring.cgi will have answers if you run into
    difficulties.

    Sinan

    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
    A. Sinan Unur, Dec 21, 2005
    #8
    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. Adam Schroeder

    can someone give me a little advice.

    Adam Schroeder, Sep 11, 2003, in forum: C++
    Replies:
    2
    Views:
    320
    Govindan
    Sep 12, 2003
  2. Senthoorkumaran Punniamoorthy

    Can someone give me a short explanation?

    Senthoorkumaran Punniamoorthy, Apr 5, 2004, in forum: Python
    Replies:
    4
    Views:
    378
    88Pro
    Apr 6, 2004
  3. grocery_stocker
    Replies:
    10
    Views:
    612
    Keith Thompson
    May 25, 2005
  4. dotNeter
    Replies:
    5
    Views:
    401
    Default User
    Aug 3, 2006
  5. Rivka Miller

    Can someone give me an example of the SNAME type ?

    Rivka Miller, Jun 30, 2010, in forum: C Programming
    Replies:
    1
    Views:
    262
    Rivka Miller
    Jul 1, 2010
Loading...

Share This Page