I need sample code for Put and GET property in WEBDAV tool with perl script
 
i.e ; PUT property => Uploads file from local system to remote server with
authentication
 
GET property => vice versa of PUT;  Downloads files from remote server to
local system;
 
Both the above things are not working in the server.
 
CODE:
 
GET PROPERTY:
 
<<<HTML FORM>>>
 
<html>
<head>
<title>WebDAV Tool</title>
</head>
<body bgcolor="#ffffcc">
<h3><u><font color="#BZZZZ"><center>Download Files /
Directory</center></font></u></h3>
<FORM name="customer_admin" ACTION="webdav_get.pl" METHOD="POST"
ENCTYPE="multipart/form-data">
<table width="100%" align="center">
<tr>
<td>Download Files/directory from url:</td>
<td><SELECT name="url"> 
<OPTION SELECTED
value="http://www.emantras.com/webdav2/";>http://www.emantras.com/webdav2/</OPTION>
</SELECT></td>
<td><input type="text" name="download" value=""/></td><td><input type="text"
name="local_folder" value=""/></td>
<td><input type="submit" name="webdav_get" value="Download">
</tr>
</table>
</form>
</body>
</html>
==============================================================================
Perl script : webdav_get.pl
 
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use HTTP::DAV;
 
my $d = new HTTP::DAV;
 
my $form = new CGI; 
 
my $url_emantras = "http://www.emantras.com/webdav2/";;
 
$d->credentials( -user=>"****", -pass =>"*****", -url =>$url_emantras);
 
$d->open( -url=>"$url_emantras" )  || die("Couldn't open $url_emantras: "
.$d->message . "\n");
 
my $fold_file = $form->param("download");
 
my $localpath = $form->param("local_folder");
 
$d->get(-url=>"$url_emantras"."$fold_file", -to=>"$localpath");
 
$d->unlock(-url => $url_emantras);
 
  print $form->header ( );
 print <<END_HTML 
 
 <HTML> 
 <HEAD> 
 <TITLE>Thanks!</TITLE> 
 </HEAD> 
<body bgcolor="ffffcc">
 <P align="center">"$fold_file" is downloaded from $url_emantras to
$localpath.</P> 
 </BODY> 
 </HTML> 
END_HTML
;
=========================================================================================================
 
PUT PROPERTY
 
<<HTML FORM>>
 
<html>
<head>
<title>WebDAV Tool</title>
</head>
<body bgcolor="#ffffcc">
<h3><u><font color="#BZZZZ"><center>Put File</center></font></u></h3>
<FORM name="customer_admin" ACTION="put_local.pl" METHOD="POST"
ENCTYPE="multipart/form-data"> 
<table width="100%" align="center">
<tr>
Put: <input type="file" name="File1" value=""/>
<input type="submit" name="sub" value="PUT ">
</tr>
</table>
</form>
</body>
</html>
***************************************************
 
Perl script  put_local.pl
 
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use HTTP::DAV;
 
my $browser = new CGI;
 
my $d = new HTTP::DAV;
 
my $url = "http://www.emantras.com/webdav2";;
 
$d->credentials(-user=>"****", -pass=>"****", -url=>"$url");
 
$d->open(-url => "$url") || die ("Could not open $url");
 
my $file = $browser->param('File1');
 
$file =~s/\\/\//gi;
 
$d->put(-local => "$file", -url=>"$url/sample/");
   $d->unlock( -url => $url );
 
   print $browser->header('');
   print "<html>";
   print "<p>$file</p>";
   
 
Both things are not working. Please workout and produce with positive
codings any how.
 
Thanks and regards
Saravanan.U


--
View this message in context: 
http://www.nabble.com/PUT-and-GET-property-of-WEBDAV-t1429563.html#a3855715
Sent from the Perl - ActivePerl forum at Nabble.com.

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to