Re: Getting the link to work
by glide (Pilgrim) on Dec 26, 2007 at 16:07 UTC
|
| [reply] |
|
|
Hi yes is apache 1.3
these is the error message that is saying :
[Wed Dec 26 10:28:05 2007] [error] [client 127.0.0.1] ReadFile(c:/orac
+le/ora92/apache/apache/cgi-bin/35854785.err) failed
[Wed Dec 26 10:28:05 2007] [error] [client 127.0.0.1] c:/oracle/ora92/
+apache/apache/cgi-bin/35854785.err is not executable; ensure interpre
+ted scripts have "#!" first line
[Wed Dec 26 10:28:05 2007] [error] [client 127.0.0.1] couldn't spawn c
+hild process: c:/oracle/ora92/apache/apache/cgi-bin/35854785.err
| [reply] [d/l] |
|
|
| [reply] |
|
|
|
|
You have problems with permissions, as you can see in the 2nd line of you log. Check the permissions of the c:/perl/bin/perl.exe, the apache user need read and execution permissions to it.
| [reply] [d/l] |
Re: Getting the link to work
by rgiskard (Hermit) on Dec 26, 2007 at 16:23 UTC
|
In the case you cannot find your errorlog file, you can add use CGI::Carp qw(fatalsToBrowser); to your cgi script and get the errors sent to your browser. | [reply] [d/l] |
|
|
Hi
the error log is saying this
[Wed Dec 26 10:28:05 2007] [error] [client 127.0.0.1] ReadFile(c:/orac
+le/ora92/apache/apache/cgi-bin/35854785.err) failed
[Wed Dec 26 10:28:05 2007] [error] [client 127.0.0.1] c:/oracle/ora92/
+apache/apache/cgi-bin/35854785.err is not executable; ensure interpre
+ted scripts have "#!" first line
[Wed Dec 26 10:28:05 2007] [error] [client 127.0.0.1] couldn't spawn c
+hild process: c:/oracle/ora92/apache/apache/cgi-bin/35854785.err
| [reply] [d/l] |
Re: Getting the link to work
by NetWallah (Canon) on Dec 26, 2007 at 18:21 UTC
|
The first purpose of your script - to display a list of files - seems to work fine.
If I understand your requirement correctly, the second purpose is
to be able to CLICK on one of the file names, and have it display the contents of that file.
In order to achieve the second purpose, your LINKS need to be coded correctly, depending on the type of file being displayed.
If the files listed were HTML files, everything would work as you expected.(.txt files should work as well). However, for file types not recognized by apache, you need to provide non-default handlers for each file-type you expect.
Instead of your "-href=>$file" link, you need to link it to code (CGI script) that will display the contents of the file.
You will end up with something like "-href=>'/displayfile.cgi?filename=$file&DIR=$fileDir'".
"As you get older three things happen. The first is your memory goes, and I can't remember the other two... "
- Sir Norman Wisdom
| [reply] |
|
|
But how can I do that??, I just need to download the file, or be able to save the file on another computer.
| [reply] |
|
|
You will need to understand and send the appropriate "content-type" as a part of the HTML header information that you return to the requesting web browser.
Typically, browsers already understand what to do with "html" and "text" type documents, and are assisted by "content-type" information which typically contains "text/html". You will need to send something like "application/zip" as the content-type.
You will also need to brush up on Multipart MIME type messages. I suggest you get a HTML programming book.
Happy learning!
"As you get older three things happen. The first is your memory goes, and I can't remember the other two... "
- Sir Norman Wisdom
| [reply] |
Re: Getting the link to work
by narainhere (Monk) on Dec 26, 2007 at 17:34 UTC
|
Hey Armando I copied and executed you program..It's fine upto listing the contents of directory.But when you start downloading file instead of the actual-path i.e"c:/files/err" it's taking http://server/servlet-name/cgi-bin/<file-to-download>
This can be resolved by coding the actual path in the script as
foreach my $file (@files) {
print $list->p(
$list->a({-href=>$fileDir."/".$file},
$file)
);
}
The world is so big for any individual to conquer
| [reply] [d/l] |
|
|
Hi it work thank you but now a new thing, when I click the filename that has the link and it gives me this error message
Firefox doesnt know how to open this address; because the protocol (c) isnt associated with any problem.
can you help me ??
| [reply] [d/l] |
|
|
The 1st step is configuring your apache to permit the download of the files you need, for example with the URL http:://localhost/files/err/35854785.err.
Now that you can download, redirecting the file request with
$list->a({-href=>"/files/err/".$file},
$file)
);
This is the simples way to resolve the problem, AFAICS. | [reply] [d/l] [select] |
Re: Getting the link to work
by pileofrogs (Priest) on Dec 26, 2007 at 17:04 UTC
|
It looks like you've got basic web server cgi setup problems.
I recommend making a super-simple "hello world" CGI and making that work before moving on.
| [reply] |
|
|
Actuallly "Hello world" works fine, listen I need this,
the program below puts in a web page the contents of the folder, only files, what I need to do is be able to download those file from that folder. but if I try to use "Save Link As.." it give me an error message or if I click on the file it give an error message.
| [reply] |