Am going read and write the xml file. i upload the xml file using below html code. if i put the xml file in cgi-bin folder it will execute and display
#!"C:\xampp\perl\bin\perl.exe"
use strict;
use warnings;
use CGI;
my $cgi = new CGI;
print $cgi->header( "text/html" );
print <<END_HERE;
<html>
<head>
<title>My First CGI Script</title>
</head>
<body bgcolor="#FFFFCC">
<p>Welcome to Perl CGI</p>
<form action="/cgi-bin/inputxml.cgi" method="post"
enctype="multipart/form-data">
<p>Files to Upload: <input type="file" name="xml" /></p>
<p><input type="submit" name="Submit" value="Submit Form" /></p>
</form>
</body>
</html>
END_HERE
But if i put the xml file in any other folder or drive (except cgi-bin folder) it shows Can't open data at C:/xampp/cgi-bin/inputxml.cgi
#!"C:\xampp\perl\bin\perl.exe"
use strict;
use CGI;
use Cwd 'abs_path';
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use File::Basename;
$CGI::POST_MAX;
my $safe_filename_characters = "a-zA-Z0-9_.-";
my $cgi = new CGI;
print $cgi->header ( );
my $file = $cgi->param('xml');
my $lines;
open(DATA,"<$file") or die "Can't open data $!";
$lines = <DATA>;
close(DATA);
print $lines;
print abs_path($file);
open(OUT, '>dirname($file)."\\out_".basename($file)');
print OUT $lines;
close(OUT);
print <<END_HERE;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thanks!</title>
<style type="text/css">
img {border: none;}
</style>
</head>
<body>
<p>Thanks for uploading your file!</p>
</body>
</html>
END_HERE
print "Welcome Come Again";
i want to execute the xml file in any folder or drive without the cgi-bin folder please any one help, thanks in advance.