Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I am creating a file transfer app that will allow users to both upload and download files. I want users to be able to download a file, just by clicking on the link. I know this is so simple, but I must be an idiot. It will not work, but when I copy the html source generated by my script and save it as a html file, it works. I am using the entire path of the file as the link. Also, when I attempt to click on the link nothing happens. Even if I right click and try to open the link in a new window, nothing happens. I am using CGI::App and this is one of my run modes. Here is the snipet:
my $self = shift; my $q = $self->query(); my $template = $self->load_tmpl("directory_tt.html"); my $dir = $q->param('dir') ? $q->param('dir') : 'c:/projects/p +ractice/dir'; my $parent_dir = $q->param('parent') ? $q->param('parent') : ' +c:/projects/practice/dir'; opendir(DIR, $dir) or die "cannot open dir $dir"; my (@dir, @files); while (defined(my $file = readdir(DIR))){ next if $file =~/^\./; my $full_path = "$dir/$file"; if (-d $full_path){ $file = "<IMG src=/icons/folder.gif>&nbsp;<a h +ref=readDir.pl?rm=displayFiles&dir=$full_path>$file</a>"; my %row = ( file => $file) +; push (@dir, \%row); } else{^M $file = qq|<IMG src=/icons/layout.png> +&nbsp;<a href="$full_path">$file</a>|; my %row = ( file => $file) +; push (@files, \%row); } } $template->param(parent=>$dir); $template->param(dir=>\@dir); $template->param(files => \@files); $template->param(dir_name=>$dir);

In reply to href = file doesnt work within script by Anonymous Monk

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (4)
    As of 2020-11-30 02:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?