Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-24 22:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found