// Establish connection to the server
$requesterSessionHash = $soapLogin->login($login, $password)->session_hash;
//save values
$project_id = $argv[1];
$tracker_id = $argv[2];
$artifact_id = $argv[3];
$summary = $argv[4];
$file = $argv[5];
$filesize = filesize($file);
$filename = basename($file);
$filetype = system('file -b --mime-type ' . escapeshellarg($file));
// Connecting to the soap's tracker client
$soapTracker = new SoapClient($serverURL . '/plugins/tracker/soap/?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE));
//executing method updateArtefact
// creating temporary file
$uuid = $soapTracker->createTemporaryAttachment($requesterSessionHash);
$value = array(array('field_name' => 'summary', 'field_label' => '', 'field_value' => array('value' => $summary)), array('field_name' => 'attachment', 'field_label' => '', 'field_value' => array('file_info' => array(array('id' => $uuid, 'submitted_by' => 0, 'description' => 'description', 'filename' => $filename, 'filesize' => $filesize, 'filetype' => $filetype, 'action' => '')))));
$total_written = 0;
$offset = 0;
$chunk_size = 20000;
$is_last_chunk = false;
while ($chunk = file_get_contents($file, false, null, $offset, $chunk_size)) {
    $chunk_length = strlen($chunk);
    $is_last_chunk = $chunk_length < $chunk_size;
    $chunk_written = $soapTracker->appendTemporaryAttachmentChunk($requesterSessionHash, $uuid, base64_encode($chunk));
    if ($chunk_written !== $chunk_length) {
        var_dump("Warning: chunk not completely written on server");
    }
    $total_written += $chunk_written;
    $offset += $chunk_size;
}