<table summary="ls" border="1"> <th>Filename</th><th>Size</th><th>Creationdate</th><th>Resource Type</th><th>Content Type</th><th>Activelock Depth</th><th>Activelock Owner</th><th>Activelock Token</th><th>Activelock Type</th> <?php foreach ($dir as $e) { $ts = $wdc->iso8601totime($e['creationdate']); $line = sprintf('<tr><td>%s </td><td>%s </td><td>%s </td><td>%s </td><td>%s </td><td>%s </td><td>%s </td><td>%s </td><td>%s </td></tr>', $e['href'], $e['getcontentlength'], date('d.m.Y H:i:s', $ts), $e['resourcetype'], $e['getcontenttype'], $e['activelock_depth'], $e['activelock_owner'], $e['activelock_token'], $e['activelock_type']); print urldecode($line); } ?> </table> <p> Create a new collection (Directory) using method webdav_client::mkcol... <?php $test_folder = '/wdc test 1 folder'; print '<br>creating collection ' . $test_folder . ' ...<br>'; $http_status = $wdc->mkcol($test_folder); print 'webdav server returns ' . $http_status . '<br>'; print 'removing collection just created using method webdav_client::delete ...<br>'; $http_status_array = $wdc->delete($test_folder); print 'webdav server returns ' . $http_status_array['status'] . '<br>'; print 'let\'s see what\'s happening when we try to delete the same nonexistent collection again....<br>'; $http_status_array = $wdc->delete($test_folder); print 'webdav server returns ' . $http_status_array['status'] . '<br>'; print 'let\'s see what\'s happening when we try to delete an existent locked collection....<br>'; $http_status_array = $wdc->delete('/packages.txt'); print 'webdav server returns ' . $http_status_array['status'] . '<br>'; $test_folder = '/wdc test 2 folder'; print 'let\'s create a second collection ...' . $test_folder . '<br>'; $http_status = $wdc->mkcol($test_folder); print 'webdav server returns ' . $http_status . '<br>'; // put a file to webdav collection
if ( !$wdc->open() ) { print 'Error: could not open server connection <br /> \r\n'; exit; } // check if server supports webdav rfc 2518 if ( !$wdc->check_webdav() ) { print 'Error: server does not support webdav or user/password may be wrong <br /> \r\n'; exit; } $http_status = $wdc->mkcol( "/backups" ); $http_status = $wdc->put_file( "/backups/" . "test.zip", "test.zip" ); print 'webdav server returns ' . $http_status. "<br/ > \r\n"; $urlToThePublishedFile = $wdc->filePublish( "/backups/test.zip" ); print 'link to the published file: ' . $urlToThePublishedFile. "<br/ > \r\n"; $fileUnpublishinStatus = $wdc->fileUnPublish( "/backups/test.zip" ); if ( $fileUnpublishinStatus ) { echo "File UnPublished correctly <br /> \r\n"; } else { echo "Some errors occured on file UnPublish <br /> \r\n"; }