Endpoint:
POST /file/upload
Description: This endpoint allows you to upload one or more files to the server using three different methods:
- Multipart Form Data Upload
- Single File Upload via JSON Body (Base64)
- Multiple File Uploads via JSON Body (Base64)
Headers:
Content-Type: multipart/form-datastorage: string(optional) - Specify storage folderX-Prefix: string(optional) - Add prefix to filename
| Key | Type | Description |
|---|---|---|
| files | File | The file(s) to upload |
- Set the request method to POST.
- Set the URL to:
{{url}}/file/upload - In the Body tab, select form-data.
- Add a key named
filesand set its type to File. - Choose the file(s) you want to upload.
- (Optional) Add any required headers (e.g.,
storage: smarterp,X-Prefix: profile). - Click Send to upload the file(s).
curl -X POST "{{url}}/file/upload" \
-H "storage: smarterp" \
-H "X-Prefix: profile" \
-F "files=@/path/to/your/file.png"{
"message": "Files uploaded successfully",
"status": 200,
"result": [
{
"originalname": "_CV Template.docx",
"encoding": "7bit",
"mimetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"destination": "storage/smarterp",
"filename": "profile_40d018f6-6638-4c93-a677-4d3126c9002c.docx",
"path": "storage\\smarterp\\profile_40d018f6-6638-4c93-a677-4d3126c9002c.docx",
"size": 234685,
"fileName": "_CV Template.docx",
"pathFile": "/file/preview/profile_40d018f6-6638-4c93-a677-4d3126c9002c.docx",
"type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"name": "profile_40d018f6-6638-4c93-a677-4d3126c9002c.docx",
"extension": "docx"
}
]
}Headers:
Content-Type: application/jsonstorage: string(optional) - Specify storage folderX-Prefix: string(optional) - Add prefix to filename
| Key | Type | Description |
|---|---|---|
| base64 | string | Base64 encoded file content (with or without data URI prefix) |
| filename | string | Name of the file |
| mimetype | string | MIME type of the file |
- Set the request method to POST.
- Set the URL to:
{{url}}/file/upload - In the Headers tab, add
Content-Type: application/json. - (Optional) Add headers:
storage: smarterp,X-Prefix: profile. - In the Body tab, select raw and choose JSON.
- Add the JSON body with base64, filename, and mimetype.
- Click Send to upload the file.
{
"base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"filename": "myimage.png",
"mimetype": "image/png"
}curl -X POST "{{url}}/file/upload" \
-H "Content-Type: application/json" \
-H "storage: smarterp" \
-H "X-Prefix: profile" \
-d '{
"base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"filename": "myimage.png",
"mimetype": "image/png"
}'{
"status": 200,
"message": "File uploaded successfully",
"result": {
"fileName": "myimage.png",
"path": "/file/preview/profile_myimage.png",
"pathFile": "/file/preview/profile_myimage.png",
"type": "image/png",
"name": "profile_myimage.png",
"extension": "png",
"size": 18456
}
}Headers:
Content-Type: application/jsonstorage: string(optional) - Specify storage folderX-Prefix: string(optional) - Add prefix to filename
| Key | Type | Description |
|---|---|---|
| files | array | Array of file objects with base64, filename, and mimetype |
- Set the request method to POST.
- Set the URL to:
{{url}}/file/upload - In the Headers tab, add
Content-Type: application/json. - (Optional) Add headers:
storage: smarterp,X-Prefix: profile. - In the Body tab, select raw and choose JSON.
- Add the JSON body with an array of files.
- Click Send to upload the files.
{
"files": [
{
"base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"filename": "myimage.png",
"mimetype": "image/png"
},
{
"base64": "data:application/pdf;base64,JVBERi0xLjQKJeLjz9MK...",
"filename": "document.pdf",
"mimetype": "application/pdf"
}
]
}curl -X POST "{{url}}/file/upload" \
-H "Content-Type: application/json" \
-H "storage: smarterp" \
-H "X-Prefix: profile" \
-d '{
"files": [
{
"base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"filename": "myimage.png",
"mimetype": "image/png"
},
{
"base64": "data:application/pdf;base64,JVBERi0xLjQKJeLjz9MK...",
"filename": "document.pdf",
"mimetype": "application/pdf"
}
]
}'{
"status": 200,
"message": "Files uploaded successfully",
"result": [
{
"fileName": "myimage.png",
"path": "/file/preview/profile_myimage.png",
"pathFile": "/file/preview/profile_myimage.png",
"type": "image/png",
"name": "profile_myimage.png",
"extension": "png",
"size": 18456
},
{
"fileName": "document.pdf",
"path": "/file/preview/profile_document.pdf",
"pathFile": "/file/preview/profile_document.pdf",
"type": "application/pdf",
"name": "profile_document.pdf",
"extension": "pdf",
"size": 45678
}
]
}