Views: 1304
Last Modified: 23.05.2019
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! The method is specified with using of the
restCommand function. This method is used to send data in
Bitrix24 and is available in the
EchoBot example as well as in this article. You can use your own function or
BX24.callMethod, or
bitrix24-php-sdk JavaScript methods.