Hello experts,
I am facing an very typical problem and hope the issue can be solved.
I have a page download.cgi in /cgi-bin folder.
use CGI;
use CGI::Carp qw ( fatalsToBrowser );
use File::Copy
copy("C:\\Program Files\\Apache Software Foundation\\Apache2.2\\cgi-bin\\tcstemp\\$reportname","H:\\") or die("cannot copy file... giridhar $!");
print "<center><table border=0>";
print "<tr><td aligh=left>";
print qq~<a href="H:\\$report_name"><img src="/images/xlsx.png" width=40 height=40></a>~;
print qq~<a href="C:\\reports\\$report_name"><img src="/images/csv.jpg" width=40 height=40></a>~;
print "</td></tr>";
print "</table></center>";
But I am not able to copy the file to other drive( in windows).
I am able to run the cgi file in browser and it is showing an error message
Software error:
Cannot copy file at C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/tcstemp/temp_final_report.cgi line 315.
I have tried multiple ways to download the file but none of them worked.
Instead of copy the file to other drive I gave the file name directly in the link to download but no luck.
And also the below way calling perl script to cgi script to copy the file to another directory. But still no luck
use CGI;
use CGI::Carp qw ( fatalsToBrowser );
use File::Copy
`perl filecopy.pl $reportname` or die("Cannot copy file");
print "<center><table border=0>";
print "<tr><td aligh=left>";
print qq~<a href="H:\\$report_name"><img src="/images/xlsx.png" width=40 height=40></a>~;
print qq~<a href="C:\\reports\\$report_name"><img src="/images/csv.jpg" width=40 height=40></a>~;
print "</td></tr>";
print "</table></center>";
filecopy code
use File::Copy;
use strict;
use warnings;
my $report_name = $ARGV[0];
copy("C:\\Program Files\\Apache Software Foundation\\Apache2.2\\cgi-bin\\tcstemp\\$report_name","H:\\") or die("cannot copy file... giridhar $!");
Could anyone please let me know what went wrong....
Tons of thanks....!!!