CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
perl permissions

 



Stiffler
Novice

Feb 29, 2000, 1:41 PM

Post #1 of 3 (668 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!


Cure
User

Feb 29, 2000, 7:39 PM

Post #2 of 3 (668 views)
Re: perl permissions [In reply to] Can't Post

Hi

To execute a CGI-SCRIPT its permissions need to be set to 755


Cure


Stiffler
Novice

Feb 29, 2000, 8:12 PM

Post #3 of 3 (668 views)
Re: perl permissions [In reply to] Can't Post

That wasn't the problem - the permissions were set to 755 - sorry I left that out, any other thoughts?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives