
Stiffler
Novice
Feb 29, 2000, 1:41 PM
Post #1 of 3
(1474 views)
|
perl permissions
|
Can't Post
|
|
This is my goal I am trying to call a .pdf file through a CGI script, although I only want people to access it through that CGI, so by default the pdf will be chmod 600. When the script is called from "../cgi-bin/thescript.cgi/files/file.pdf" it will check to see if the user is registered and then if they are - chmod 644 file.pdf, then load the file by the following subroutine: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> $path = "$ENV{'PATH_INFO'}" ; $path =~ s!/!:!g; ($blank, $cgi, $query) = split (/:/, $path); chmod (0644, "files/$query"); $file = "files/$query"; if (open(FOO,$file)) { $len = -s $file; binmode FOO; print "Content-type: application/pdf\nContent-length: $len\n\n"; print <FOO>; close FOO; } else { print "Content-type: text/plain\n\nCan't open $file: $!\n"; exit; } chmod (0600, "files/$query"); </pre><HR></BLOCKQUOTE> After pre-loading and printing to the screen it will chmod 600 file.pdf and exit. My problem is that in IE this subroutine will load the Acrobat plug-in and then it looks like it will load the file, but returns a blank screen and in the title bar the URL reads "http://www.blahblah.com/cgi-bin/thescript.cgi/files/file.pdf." Any suggestions on how to get this to work. Feel free to email me with suggestions. 10-Q!
|