Skip to content

Upload files

  Method: POST

/api/ps/file/upload

  Headers

  • 'Content-Type': 'multipart/form-data'

Code samples

const formData = new FormData();
formData.append("file", file);

await fetch('/api/ps/file/upload', {
    method: 'POST',
    body: formData
}).then(async (response) => {
    console.log(response)
})
  HTTP response status codes
Status code Description
200 OK
400 Bad Request
500 Internal Error

  Status: 200

{
    "id": 1,
    "fileName": "d523f3fb-a8fe-49d9-9e67-3ce8b3231037.png",
    "fileMime": "image/png",
    "originalFileName": "screenshot-17.png",
    "createAt": 1661592987307,
    "isRelationArticle": true,
    "isRelationProject": false
}

  Status: 400

{
    "code": 400,
    "message": "Error upload file"
}

  Status: 500

{
    "code": 500,
    "message": "Internal Error"
}