Skip to main content

File upload

An endpoint is already available for file upload. it is /api/upload/default and it accepts any file. you can see it in your app configuration

app:
upload-configuration:
upload-options:
default:
upload-path: /uploads
server-path: G:\Workspace\Ibonia\FicheListe\uploads\uploads
allowed-types: '*'
max-size: 2000000
overwrite: true

If you want to add or change another configuration, you can just add a new upload option and a new end-point will be available.

app:
upload-configuration:
upload-options:
default:
upload-path: /uploads
server-path: G:\Workspace\Ibonia\FicheListe\uploads\uploads
allowed-types: '*'
max-size: 2000000
overwrite: true
images:
upload-path: /images
server-path: G:\Workspace\Ibonia\FicheListe\uploads\images
allowed-types: 'png|jpeg'
max-size: 2000000
overwrite: true

In this case, two endpoints will be available,

  • /api/upload/default
  • /api/upload/images

Upload option

OptionDescription
upload-paththis is how the user will access the uploaded file
server-paththe path where we store the uploaded files (it should end with upload-path)
allowed-typesfile types allowed Pipe separated values
max-sizeMaximum size of the file
overwriteIf true and two files happens to have the same name, the other one will be overwritten.