---
sidebar_position: 4
description: Upload file and other functions to work with Google Drive in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Google Drive]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Upload file
 Uploads a file to the drive



`Function UploadFile(Val Token, Val File, Val Description) Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Token | --token | String | &#x2714; | Token |
  | File | --file | BinaryData,String | &#x2714; | File to be uploaded |
  | Description | --props | Map Of KeyAndValue | &#x2714; | See GetFileDescription |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from Google

:::tip
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    Token     = "ya29.a0Aa7pCA9fmPZk2eeWvC-VVPtSY4UzLqhBxacbBQw80RgQUw_wRm7_TGYppXdco1mWX6DVhkJklByQ4epXj_yOMf3j0BVPvNq966JHEVow5jOasNoGJdGn27Rq4...";
    Directory = "191iyaa6-2BCNRPOF0F8mQ0TuNWPNesdM";
    Image     = "https://hut.openintegrations.dev/test_data/picture.jpg"; // URL, Binary Data or File path

    Clear       = False;
    Description = OPI_GoogleDrive.GetFileDescription(Clear);

    Description.Insert("Parent", Directory);

    Result = OPI_GoogleDrive.UploadFile(Token, Image, Description);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint gdrive UploadFile \
             --token "***" \
             --file "https://hut.openintegrations.dev/test_data/picture.jpg" \
             --props "{'MIME':'image/jpeg','Name':'New file.jpg','Description':'This is a new file','Parent':'1RA5EV-HEr2SDzooZLmZ2h6HnnmZ0EHzP'}"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint gdrive UploadFile ^
             --token "***" ^
             --file "https://hut.openintegrations.dev/test_data/picture.jpg" ^
             --props "{'MIME':'image/jpeg','Name':'New file.jpg','Description':'This is a new file','Parent':'1RA5EV-HEr2SDzooZLmZ2h6HnnmZ0EHzP'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "kind": "drive#file",
 "id": "1kdqXtBzb_j_p0-IVGikjKNMCs6W6Rmt5",
 "name": "New file.jpg",
 "mimeType": "image/jpeg"
}
```
