http://www.perlmonks.org?node_id=316863

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

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);