function put_file($path, $filename) {
        // try to open the file ...


        $handle = @fopen ($filename, 'r');

        if ($handle) {
            // $this->sock = pfsockopen ($this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout);
            $this->_path = $this->translate_uri($path);
            $this->header_unset();
            $this->create_basic_request('PUT');
            // add more needed header information ...
            $this->header_add('Content-length: ' . filesize($filename));
            $this->header_add('Content-type: application/octet-stream');
            // send header
            $this->send_request();
            while (!feof($handle)) {
                fputs($this->sock,fgets($handle,4096));
            }
            fclose($handle);
            $this->get_respond();
            $response = $this->process_respond();

            // validate the response
            // check http-version
            if ($response['status']['http-version'] == 'HTTP/1.1' ||
                $response['status']['http-version'] == 'HTTP/1.0') {
                    // seems to be http ... proceed
                    // We expect a 200 or 204 status code
                    // see rfc 2068 - 9.6 PUT...
                    // print 'http ok<br>';
                    return $response['status']['status-code'];
                }
            // ups: no http status was returned ?
            return false;
        } else {
            $this->_error_log('put_file: could not open ' . $filename);
            return false;
        }

    }
function put_file($path, $filename) {
        // try to open the file ...


        $handle = @fopen ($filename, 'r');

        if ($handle) {
            // $this->sock = pfsockopen ($this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout);
            $this->_path = $this->translate_uri($path);
            $this->header_unset();
            $this->create_basic_request('PUT');
            // add more needed header information ...
            $this->header_add('Content-length: ' . filesize($filename));
            $this->header_add('Content-type: application/octet-stream');
            // send header
            $this->send_request();
            while (!feof($handle)) {
                fputs($this->sock,fgets($handle,4096));
            }
            fclose($handle);
            $this->get_respond();
            $response = $this->process_respond();

            // validate the response
            // check http-version
            if ($response['status']['http-version'] == 'HTTP/1.1' ||
                $response['status']['http-version'] == 'HTTP/1.0') {
                    // seems to be http ... proceed
                    // We expect a 200 or 204 status code
                    // see rfc 2068 - 9.6 PUT...
                    // print 'http ok<br>';
                    return $response['status']['status-code'];
                }
            // ups: no http status was returned ?
            return false;
        } else {
            $this->_error_log('put_file: could not open ' . $filename);
            return false;
        }

    }
function put_file ( $ path , $ filename ) { // try to open the file ... $ handle = @ fopen ( $ filename , 'r' ) ; if ( $ handle ) { // $this->sock = pfsockopen ($this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout); $ this -> _path = $ this -> translate_uri ( $ path ) ; $ this -> header_unset ( ) ; $ this -> create_basic_request ( 'PUT' ) ; // add more needed header information ... $ this -> header_add ( 'Content-length: ' . filesize ( $ filename ) ) ; $ this -> header_add ( 'Content-type: application/octet-stream' ) ; // send header $ this -> send_request ( ) ; while ( ! feof ( $ handle ) ) { fputs ( $ this -> sock , fgets ( $ handle , 4096 ) ) ; } fclose ( $ handle ) ; $ this -> get_respond ( ) ; $ response = $ this -> process_respond ( ) ; // validate the response // check http-version if ( $ response [ 'status' ] [ 'http-version' ] == 'HTTP/1.1' || $ response [ 'status' ] [ 'http-version' ] == 'HTTP/1.0' ) { // seems to be http ... proceed // We expect a 200 or 204 status code // see rfc 2068 - 9.6 PUT... // print 'http ok<br>'; return $ response [ 'status' ] [ 'status-code' ] ; } // ups: no http status was returned ? return false ; } else { $ this -> _error_log ( 'put_file: could not open ' . $ filename ) ; return false ; } }
Public method put_file

Read a file as stream and puts it chunk by chunk into webdav server collection.

Look at php documenation for legal filenames with fopen();
The filename will be translated into utf-8 if not allready in utf-8.

@param string targetpath, string filename
@return int status code. False on error.
Public method put_file