Hi
I am trying to upload file using webDAV property in perl.
Front page using html
<html>
<head>
<title>WebDAV Tool</title>
</head>
<body bgcolor="#ffffcc">
<FORM ACTION="http://localhost/virtual/server1.pl" METHOD="post">
<b>File 1</b>: <INPUT TYPE="file" NAME="file1" SIZE=40><br/>
<br/>
<table width="100%">
<tr>
<td width="25%"> </td><td width="50%"><INPUT TYPE="submit" name="Submit" value="SUBMIT"><br/>
</form>
</body>
</html>
Back end file server1.pl
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use HTTP::DAV;
$d = new HTTP::DAV;
$url ="http://www.emantras.com/webdav2/";
$d->credentials( -user=>"vijay", -pass =>"emantras", -url =>$url);
$d->open( -url=>"$url" ) || die("Couldn't open $url: " .$d->message . "\n");
# $upload_dir = "d://perl_up";
$upload_dir = "$url"."xdb1";
$query = new CGI;
$filename = $query->param("file1");
# $email_address = $query->param("emailaddress");
$filename =~ s/.*[\/\\](.*)/$1/;
if ( $d->put( -local => "$filename", -url => $upload_dir))
{
print "successfully uploaded $filename to $upload_dir\n";
}
else
{
print "put failed: " . $d->message . "\n";
}
$d->unlock( -url => $upload_dir );
print $query->header ( );
print <<END_HTML
<HTML>
<HEAD>
<TITLE>Thanks!</TITLE>
</HEAD>
<body bgcolor="#ffffcc">
<P>Your file has been uploaded!</P>
</BODY>
</HTML>
END_HTML
;
Error :
Software error:
Can't locate HTTP/DAV.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at C:\Inetpub\wwwroot\virtual\server1.pl line 3.
BEGIN failed--compilation aborted at C:\Inetpub\wwwroot\virtual\server1.pl line 3.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
I am endeavour to implement WEBDAV method for uploading file/files with perl as back end. The front page is constructed in html. We are trying to get action from perl script. I have used HTTP::DAV and paste the same in c:\perl\lib\ directory.
Could you recover or give exact solution for the above error which pasted above.
Thanks and regards
Saravanan.U
Error in perl programs
-
- Posts: 3451
- Joined: November 30th, 2002, 12:30 pm
Please use bbcode's [ code ][ /code ] tags around your code to ensure we don't lose anything.
The first step usually recommended in debugging perl scripts is to run them at the command line, on the server, with perl -w. That will often give you a better idea of what's going on. The second step is to actually read the error message.
The first step usually recommended in debugging perl scripts is to run them at the command line, on the server, with perl -w. That will often give you a better idea of what's going on. The second step is to actually read the error message.
It looks to me like you need to get the DAV perl module installed on the server.Can't locate HTTP/DAV.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at C:\Inetpub\wwwroot\virtual\server1.pl line 3.
BEGIN failed--compilation aborted at C:\Inetpub\wwwroot\virtual\server1.pl line 3.