Views: 2988
Last Modified: 23.03.2022

Saves file to your Bitrix24.Drive

Revision: 21
Get information on the current API revision (platform version) – im.revision.get.

Parameters

Parameter Example Req. Description Revision
DISK_ID 112 Yes File ID 21

Method call

JavaScript

BX24.callMethod('im.disk.file.save', {
  'DISK_ID': 112,
}, function(result){
  if(result.error())
  {
    console.error(result.error().ex);
  }
  else
  {
    console.log(result.data());
  }
});

PHP

$result = restCommand('im.disk.file.save', Array(
  'DISK_ID' => 112,
), $_REQUEST["auth"]);

Response example

{
  "result": {
    "folder": {"id": 130, "name": "Saved file"},
    "file": {"id": 578, "name": "image.png"}
  }
}

Example of response with error

{
  "error": "FILE_ID_EMPTY",
  "error_description": "File ID can't be empty"
}

Description of keys:

  • error – error code
  • error_description – error brief description

Possible error codes

Код Description
FILE_SAVE_ERROR Unable to delete file
FILE_ID_EMPTY Unable to pass file ID

Attention: restCommand function is used here for illustration purposes only. It is taken from the EchoBot example. You can send a REST command with your own function, or use the BX24.callMethod or bitrix24-php-sdk methods.





Courses developed by Bitrix24