/**
  * Write content to braArkiv
  * @param object $p path_parts
  * @param string $content filecontent
  * @return boolean.  True if copy is ok, False otherwise.
  */
 public function write($to, $content, $fileid = 0)
 {
     if (!$fileid) {
         $fileid = $this->get_file_id($to);
         //this represent the document
     }
     $bra5ServiceFile = new Bra5ServiceFile();
     if ($bra5ServiceFile->fileTransferSendChunkedInit(new Bra5StructFileTransferSendChunkedInit($this->secKey, $fileid, $to->fake_name_clean))) {
         $transaction_id = $bra5ServiceFile->getResult()->getfileTransferSendChunkedInitResult()->fileTransferSendChunkedInitResult;
     } else {
         _debug_array($bra5ServiceFile->getLastError());
         die;
     }
     $new_string = chunk_split(base64_encode($content), 1048576);
     // Definerer en bufferstørrelse/pakkestørrelse på ca 1mb.
     $content_arr = explode('\\r\\n', $new_string);
     foreach ($content_arr as $content_part) {
         $bra5ServiceFile->fileTransferSendChunk(new Bra5StructFileTransferSendChunk($this->secKey, $transaction_id, $content_part));
     }
     $ok = !!$bra5ServiceFile->fileTransferSendChunkedEnd(new Bra5StructFileTransferSendChunkedEnd($this->secKey, $transaction_id));
     /*
     			_debug_array($bra5ServiceFile->getResult());
     */
     //			die();
     if (!$ok) {
         _debug_array($bra5ServiceFile->getLastError());
     }
     //	_debug_array($fileid);
     return $ok;
 }
Exemplo n.º 2
0
 */
$bra5ServiceFile = new Bra5ServiceFile();
// sample call for Bra5ServiceFile::fileTransferSendChunkedInit()
if ($bra5ServiceFile->fileTransferSendChunkedInit(new Bra5StructFileTransferSendChunkedInit())) {
    print_r($bra5ServiceFile->getResult());
} else {
    print_r($bra5ServiceFile->getLastError());
}
// sample call for Bra5ServiceFile::fileTransferSendChunk()
if ($bra5ServiceFile->fileTransferSendChunk(new Bra5StructFileTransferSendChunk())) {
    print_r($bra5ServiceFile->getResult());
} else {
    print_r($bra5ServiceFile->getLastError());
}
// sample call for Bra5ServiceFile::fileTransferSendChunkedEnd()
if ($bra5ServiceFile->fileTransferSendChunkedEnd(new Bra5StructFileTransferSendChunkedEnd())) {
    print_r($bra5ServiceFile->getResult());
} else {
    print_r($bra5ServiceFile->getLastError());
}
// sample call for Bra5ServiceFile::fileTransferRequestChunkedInit()
if ($bra5ServiceFile->fileTransferRequestChunkedInit(new Bra5StructFileTransferRequestChunkedInit())) {
    print_r($bra5ServiceFile->getResult());
} else {
    print_r($bra5ServiceFile->getLastError());
}
// sample call for Bra5ServiceFile::fileTransferRequestChunk()
if ($bra5ServiceFile->fileTransferRequestChunk(new Bra5StructFileTransferRequestChunk())) {
    print_r($bra5ServiceFile->getResult());
} else {
    print_r($bra5ServiceFile->getLastError());