![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script for download files from ftp site | tiff-matt | Shell Programming and Scripting | 5 | 09-19-2008 03:46 PM |
| Download files using perl | mirusnet | UNIX for Dummies Questions & Answers | 2 | 12-19-2007 10:04 PM |
| download files from direct links tool? | umen | UNIX for Dummies Questions & Answers | 2 | 07-04-2006 11:00 AM |
| shellscript for download files | ram2s2001 | Shell Programming and Scripting | 3 | 02-07-2006 08:16 AM |
| How to download Red hat plz Hlp ? | atiato | UNIX for Dummies Questions & Answers | 3 | 02-05-2002 01:21 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
download files
Hi,
I experience some difficulties to perform a script to be able to download some files via HTTP. The Perl script is located on a Linux in a server ("/var/www/cgi-bin/down.pl") where I can run it via Internet Explorer. I'm able to display the directory content ("/home/toto") but I'm not able to open or save the files from this directory to my local machine (Windows XP by example). My goal is to be able to save a file when I click on them and choose the target on my local machine. Can someone help me to fix this script? thanks in advance. Code:
#!/usr/bin/perl
use CGI;
$|=1;
my $query=new CGI;
print qq~
<table align="center" width="90%">
<tr><td><font color="black" face="Arial" size="4"><b>Files in current directory</b></td></tr>
<tr>
<td valign="top">
<font color="black" face="Arial" size="2">
~;
$dir="/home/toto";
opendir(DIR, "$dir");
@current = readdir(DIR);
closedir(DIR);
foreach(@current){
unless($_ eq '.' || $_ eq '..' || -d qq~$dir/$_~){
push(@currentfiles, $_);
}
}
@currentfiles = sort { uc($a) cmp uc($b) } @currentfiles;
for($aa = 0; $aa <= $#currentfiles; $aa++){
print qq~
<a href="$dir/$currentfiles[$aa]" target="_blank">$currentfiles[$aa]</a><a href="$dir/$currentfiles[$aa]"> </a></font><br>
~;
}
print qq~
</font></tr>
</table>
Last edited by otheus; 03-08-2009 at 11:42 AM.. Reason: code tags added |
|
||||
|
The links won't work if your webserver is not configured to allow access these files, and your webserver can probably make its own listing of them anyway, no script required.
Also, please put code in [ code ] code tags [ /code ], it makes it much more readable. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|