Documentation

landing.block.uploadfile

landing.block.uploadfile(block, picture)

The method downloads image and binds it to a specified block. On success, returns a pair: direct path to downloaded file and the saved file ID. Form this moment, the image will be deleted only when a block, landing page (that includes the block) are fully deleted or via calling the method landing.landing.removeEntities.

Parameters

Parameter Description Available from version
block Block ID
picture Variants:
  1. Path to image, located at a web URL.
  2. document.getElementById('file') in case of working via JS API.
  3. Array name + content
    {
       0: 'name.jpg',
       1: 'base64-file content'
    }

Example

BX24.callMethod(
   'landing.block.uploadfile',
   {
      block: 12294,
      picture: 'https://site.com/******.jpg'
//      picture: document.getElementById('file')
   },
   function(result)
   {
      if(result.error())
      {
         console.error(result.error());
      }
      else
      {
         console.info(result.data());
      }
   }
);


© «Bitrix24», 2001-2024