Documentation

disk.storage.uploadfile

disk.storage.uploadfile

Uploads a new file to the storage root.

In case of success, it returns a structure similar to that of disk.file.get.

Response example:

"result": {
    "ID": "10",
    "NAME": "2511.jpg",
    "CODE": null,
    "STORAGE_ID": "4",
    "TYPE": "file",
    "PARENT_ID": "8",
    "DELETED_TYPE": "0",
    "CREATE_TIME": "2015-04-24T10:41:51+03:00",
    "UPDATE_TIME": "2015-04-24T15:52:43+03:00",
    "DELETE_TIME": null,
    "CREATED_BY": "1",
    "UPDATED_BY": "1",
    "DELETED_BY": "0",
    "DOWNLOAD_URL": "https://test.bitrix24.com/disk/downloadFile/10/?&ncc=1&filename=2511.jpg&auth=******",
    "DETAIL_URL": "https://test.bitrix24.com/workgroups/group/3/disk/file/2511.jpg"
}

Parameters

Parameter Description
id Storage ID.
fileContent Similar to 'DETAIL_PICTURE' in the example Files Processing.
data An array describing the file. Mandatory field NAME contains the name of the new file.

Example

BX24.callMethod(
		"disk.storage.uploadfile",
		{
			id: 4,
			data: {
				NAME: "2511.jpg"
			},
			fileContent: document.getElementById('test_file_input')
		},
		function (result)
		{
			if (result.error())
				console.error(result.error());
			else
				console.dir(result.data());
		}
);




User Comments

User comments are not part of official documentation. Use information provided by other users in the comments at your own risk.

The User Comments section is not to be used as a feature discussion board. Only registered users can post comments. Your comment will be visible once it has been approved by the moderator.
© «Bitrix Inc.», 2001-2021, «Bitrix Inc.», 2021