Hi Monks,

I am writing a small CGI script wherein the script will list all the files in a directory. I am able to list the files successfully but i am also trying to provide a link to the files which seems to have some problem.

In the below code, i have just showed the section where i provide the link to the file because i am able to get the list of files in the directory successfully

#!C:/Strawberry/Perl/bin/perl.exe use strict; use warnings; use diagnostics; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); my $cgi=new CGI; print $cgi->header(); print $cgi->start_html("My Submissions"); print "<body bgcolor=#c0c0c0>"; #Link to a sample file in the directory print "<h3><a href=\"file:///c:/temp/g.venkatesan/upload/test.txt\">Le +on</a></h3><br>"; print "</body>"; print $cgi->end_html();

The problem with this is, when i click on the link, the corresponding file is not opening. Infact, nothing is happening. But when i copy and paste the same link in a browser, the file is opening.

Could someone help me out with this issue? I have tried the code in both IE6 and Firefox 3.5.3

Thanks in advance!!!

In reply to Problem linking a file in CGI script by venkatesan_G02

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.