in reply to Why can I not acess files outside cgi-bin directory?

Based on the information supplied, I can only offer some suspicions:
Server configuration?
OS? are you truly running your server on windoze, or -- as I did once -- are you testing on an MS box and then being befuddled when *n*x did not like what I'd done?
or might you have a code issue?
... in which case, posting some code would help us help you (though the double backslashes look vaguely questionable).

Welcome... Hope someone can help based on what you've given us, but please check out the various FAQs and guides, for how to get better help on further posts.

  • Comment on Re: Why I can not acess files outside cgi-bin directory?

Replies are listed 'Best First'.
Re^2: Why I can not acess files outside cgi-bin directory?
by perlfeng (Initiate) on Mar 24, 2005 at 21:33 UTC
    Hi, thank you schodckwm, here is my testing code. I used active perl 5.81 on windows xp. It seems that the I need use \\ to represent the '\' on windows to represent directory delimiter. The code works if I use $filename = "test.txt";.
    #!c:/perl/bin/perl -w use CGI; # only files in cgi-bin directory works? #filename = "C:\\Program Files\\Apache Group\\Apache2\\htdocs\\project +s\\Generate_Conc_xls\\test.txt"; $filename = "test.txt"; $header1 = "Content-disposition: attachment; filename=$filename\n"; $mime_type = "application/octet-stream"; #print header for downloading file to client print $header1; print "Content-Type: $mime_type\n\n"; #print content to client file open (READ, "<$filename"); binmode READ; local $/; print <READ>; close(READ);
    Thanks a lot.

      Change your code to test that your open succeeds:

      open( READ, "<$filename" ) or die "Failed to open $filename - error $! +";

      That might provide some clues in your webservers error log.

      Steve
      ---
      steve.org.uk
        It doesn't work because it seems that the server is always thinking, openning or reading file there and the status bar stuck at ~50%. Really confused!