2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 2
2025-05-05 11:15:20 +03:00
description: Upload file to the folder and other functions to work with Bitrix24 in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Bitrix24]
2024-10-15 10:16:04 +03:00
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Upload file to the folder
Upload local file to the folder
`Function UploadFileToFolder(Val URL, Val Name, Val File, Val FolderID, Val Token = "") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| URL | --url | String | ✔ | URL of webhook or a Bitrix24 domain, when token used |
| Name | --title | String | ✔ | File name with extension |
| File | --file | String, BinaryData | ✔ | File for upload |
| FolderID | --folderid | String | ✔ | Folder identifier |
| Token | --token | String | ✖ | Access token, when app auth method used |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
<br/>
:::tip
2024-11-21 14:55:35 +03:00
Method at API documentation: [disk.folder.uploadfile](https://dev.1c-bitrix.ru/rest_help/disk/folder/disk_folder_uploadfile.php)
2024-10-15 13:51:58 +03:00
Parameters with Binary data type can also accept file paths on disk and URLs
2024-10-15 10:16:04 +03:00
:::
<br/>
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-10-15 10:16:04 +03:00
Filename2 = "Picture2.jpg";
Name = "Picture1.jpg";
2025-10-21 11:36:43 +03:00
Image2 = "https://hut.openintegrations.dev/test_data/picture.jpg"; // Local path, URL or Binary Data
Image = "https://hut.openintegrations.dev/test_data/picture2.jpg"; // Local path, URL or Binary Data
2024-10-15 10:16:04 +03:00
2025-10-31 15:42:42 +03:00
DestinationID = "46138";
2024-10-15 10:16:04 +03:00
2025-10-21 11:36:43 +03:00
URL = "https://b24-ar17wx.bitrix24.by/rest/1/h0m...";
2024-10-15 10:16:04 +03:00
Result = OPI_Bitrix24.UploadFileToFolder(URL, Filename2, Image2, DestinationID);
2025-10-21 11:36:43 +03:00
URL = "b24-ar17wx.bitrix24.by";
2025-10-31 15:42:42 +03:00
Token = "53100369006e9f06006b12e400000001000...";
2024-10-15 10:16:04 +03:00
Result = OPI_Bitrix24.UploadFileToFolder(URL, Name, Image, DestinationID, Token);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint bitrix24 UploadFileToFolder \
2025-10-07 19:27:04 +03:00
--url "b24-ar17wx.bitrix24.by" \
--title "Imortant doc.docx" \
--file "https://hut.openintegrations.dev/test_data/document.docx" \
2025-10-31 15:42:42 +03:00
--folderid 46430 \
2025-09-16 09:07:33 +03:00
--token "***"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint bitrix24 UploadFileToFolder ^
2025-10-07 19:27:04 +03:00
--url "b24-ar17wx.bitrix24.by" ^
--title "Imortant doc.docx" ^
--file "https://hut.openintegrations.dev/test_data/document.docx" ^
2025-10-31 15:42:42 +03:00
--folderid 46430 ^
2025-09-16 09:07:33 +03:00
--token "***"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"result": {
2025-10-31 15:42:42 +03:00
"ID": 46690,
2024-10-15 10:16:04 +03:00
"NAME": "Picture1.jpg",
"CODE": null,
"STORAGE_ID": "3",
"TYPE": "file",
2025-10-31 15:42:42 +03:00
"PARENT_ID": "46678",
2024-10-15 10:16:04 +03:00
"DELETED_TYPE": 0,
"GLOBAL_CONTENT_VERSION": 1,
2025-10-31 15:42:42 +03:00
"FILE_ID": 31522,
2024-10-15 10:16:04 +03:00
"SIZE": "805191",
2025-10-31 15:42:42 +03:00
"CREATE_TIME": "2025-10-31T11:55:19+00:00",
"UPDATE_TIME": "2025-10-31T11:55:19+00:00",
2024-10-15 10:16:04 +03:00
"DELETE_TIME": null,
"CREATED_BY": "1",
"UPDATED_BY": "1",
"DELETED_BY": null,
2025-10-31 15:42:42 +03:00
"DOWNLOAD_URL": "https://b24-ar17wx.bitrix24.by/rest/download.json?auth=a5b00469006e9f06006b12e40000000100000762e9a0e4089523daef20ed6e7d61f7bf&token=disk%7CaWQ9NDY2OTAmXz1NQm1xaFBnaEZFa1ZXMWhURDd3Q0ZIZldaanJrV2tndw%3D%3D%7CImRvd25sb2FkfGRpc2t8YVdROU5EWTJPVEFtWHoxTlFtMXhhRkJuYUVaRmExWlhNV2hVUkRkM1EwWklabGRhYW5KclYydG5kdz09fGE1YjAwNDY5MDA2ZTlmMDYwMDZiMTJlNDAwMDAwMDAxMDAwMDA3NjJlOWEwZTQwODk1MjNkYWVmMjBlZDZlN2Q2MWY3YmYi.76bd7t5gBQsR0jr3QCA%2BetFi%2FQQ7eL6VagaatIbTOzg%3D",
2024-10-15 10:16:04 +03:00
"DETAIL_URL": "https://b24-ar17wx.bitrix24.by/docs/file/New catalog/Picture1.jpg"
}
}
```