Upload file

Upload file endpoint accepts multiple content-type;

  • "multipart/form-data" (for binary form-data file uploads, URL, base64)

  • "application/x-www-form-urlencoded" (URL, base64) (our usual request type)

  • "application/json" (URL,base64) (our usual request type)

Upload file to your IM Cloud Storage

POST https://api.imagemash.io/v1/storage/getFiles

Headers

Name
Type
Description

apikey*

String

Your API Key

Request Body

Name
Type
Description

file*

Multiple

Accepts 3 type;

binary: As form-data (buffer), base64: As base64 string, URL: URL of a file. Eg. https://examle.com/logo.png

fileName*

String

Name of your file with extension. Eg. logo.png , code.js, ...

parentPath

String

Parent path of your file. Leave empty or use / to upload file to home directory. Eg. /cars/small_cars

Default: /

{
    "name": "small_jeep.png",
    "type": "image",
    "filePath": "/cars/small_jeep.png",
    "folderPath": "/cars",
    "width": 8511,
    "height": 6323,
    "tags": [],
    "format": "png",
    "mime": "image/png",
    "size": 248971,
    "sizeHuman": "243,14 KB",
    "thumbnail": "https://demo.imagemash.io/cars/small_jeep.png?tr=imagemash,w_250,q_80,f_webp",
    "url": "https://demo.imagemash.io/cars/small_jeep?tr=imagemash",
    "createdAt": "2019-01-13T19:42:35.565Z",
    "updatedAt": "2019-01-13T19:42:35.565Z"
}

Example Codes - Binary(form-data)

curl --location --request POST 'https://api.imagemash.io/v1/storage/uploadFile' \
--header 'apikey: your_api_key' \
--form 'file=@"/C:/Users/Desktop/small_jeep.png"' \
--form 'parentPath="/cars"'

Example Codes - URL/base64

curl --location --request POST 'https://api.imagemash.io/v1/storage/uploadFile' \
--header 'apikey: your_api_key' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'file=https://example.com/logo.png' \
--data-urlencode 'parentPath=/my_logos'

Last updated