Answer the question
In order to leave comments, you need to log in
How to upload a file to disk in Bitrix24 using the API?
I read and tried a lot of examples of uploading and attaching a file to a task from the documentation, but the result was not achieved.
Using the CFile::SaveFile method, the file is loaded, an ID is assigned to it, and, according to the documentation, using
if (CModule::IncludeModule("tasks"))
{
$ID = 1;
$arFiles = array(102, 34, 5);
CTasks::AddFiles($ID, $arFiles);
}
if (CModule::IncludeModule('disk') && CModule::IncludeModule('tasks')){
$oTask = new CTaskItem($task_id, $user_id);
$arFields = array(
"UF_TASK_WEBDAV_FILES" => array("n".$disk_file_id)
);
try
{
if ( ! $oTask->update($arFields) )
throw new TasksException();
}
catch (TasksException $e)
{
print_r($e);
return;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question