1. Home
  2. Docs
  3. API Documentation
  4. Storage
  5. UploadFile

UploadFile

Route: https://api.kayran.live/UploadFile

Users can use this function to Upload Files onto their Storage.

Roles Required: Admin, User and Private User.

Request Syntax

{

“apiKey”: “String”,
“name”: “String”,
“file”: File encoded to base64

}


Request Parameters

Parameters being used in the Request

Parameter Name :

apiKey

Parameter Usage and Options :

Your Kayran given API Key.

How do I get it ? :

Located in the “Profile” section.

Note : by default, the “API Status” is enabled, unless, the Admin has disabled it in the “Server Settings” section.

Type :

String

Is it Optional ? :

No.


Parameter Name :

name

Parameter Usage and Options :

The exact Name of the File you wish to Upload.

For example: file1.txt –> file1.txt (inc. the Extension).

Type :

String

Is it Optional ? :

No.


Parameter Name :

File

Parameter Usage and Options :

The File you wish to Upload encoded to base64

Python code:

def encode_file_to_base64(file_path):
with open(file_path, 'rb') as file:
return base64.b64encode(file.read()).decode('utf-8')

Type :

Any File.

Is it Optional ? :

No.


Successful Response

{

    “Error”: 0,

    “Function”: “UploadFile”,

    “Data”: “Uploaded Successfully”

}

Errors and their Possible Causes

For more information, please refer to the General Errors section.