Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How to give (put to browser) someone PDF document, with hidden path to document.

Reply
Thread Tools

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

 
 
MAX
Guest
Posts: n/a
 
      12-20-2005
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


 
Reply With Quote
 
 
 
 
Ian Wilson
Guest
Posts: n/a
 
      12-20-2005
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.
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      12-20-2005
MAX <(E-Mail Removed)> 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
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Larry
Guest
Posts: n/a
 
      12-21-2005
Tad McClellan wrote:
> MAX <(E-Mail Removed)> 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".

 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      12-21-2005
Larry <(E-Mail Removed)> wrote:
> Tad McClellan wrote:
>> MAX <(E-Mail Removed)> 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
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
axel@white-eagle.invalid.uk
Guest
Posts: n/a
 
      12-21-2005
Tad McClellan <(E-Mail Removed)> wrote:
> MAX <(E-Mail Removed)> 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

 
Reply With Quote
 
Robert Sedlacek
Guest
Posts: n/a
 
      12-21-2005
(E-Mail Removed) 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
 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      12-21-2005
(E-Mail Removed) wrote in
news:81bqf.12614$(E-Mail Removed) .uk:

> Tad McClellan <(E-Mail Removed)> wrote:
>> MAX <(E-Mail Removed)> 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 <(E-Mail Removed)>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Postscript to PDF with pdf-tools, pdf-writer, or other Sean Nakasone Ruby 1 04-14-2008 09:13 PM
PDF::Writer, create pdf and insert in other pdf file. Ricardo Pog Ruby 1 03-26-2008 08:24 PM
Give us 3 minutes; we give you the whole library lib Computer Support 1 02-04-2005 03:16 AM
Give us 3 minutes; we give you the whole library lib Computer Support 0 01-27-2005 07:52 AM



Advertisments