This project allow you to upload files in a persistent volume (file folder) 📝 by a REST API
To use this project you could use the Dockerfile to build a local image or clone and run locally
- Java 1.8 +
- maven
- Docker
Once you have cloned this project:
cd thc-upload-files-java
mvn clean package
mvn spring-boot:run
cp Dockerfle target/
cd target
docker build -t thc-upload-images-local .
docker run -ti -d -p 8080:8080 --restart=always -v $(pwd)/upload:/upload-dir/ --name local-files-thc thc-upload-images-local
Now you will be able to use postman to call:
- POST http://localhost:8080/api/uploadFile/folder-imgs --> "folder-imgs" is a mandatory path variable, this endpoint sotore a file
- GET http://localhost:8080/api/getFiles --> Get all files
- GET http://localhost:8080/api/files/folder-imgs/sample.jpg --> display an stored image
- DELETE http://localhost:8080/api/deleteFile/uploadFile/sample.jpg --> delete a file
until finished
mvn spring-boot:run
Now you will be able to use postman to call:
- POST http://localhost:8080/api/uploadFile/folder-imgs --> "folder-imgs" is a mandatory path variable, this endpoint sotore a file
- GET http://localhost:8080/api/getFiles --> Get all files
- GET http://localhost:8080/api/files/folder-imgs/sample.jpg --> display an stored image
- DELETE http://localhost:8080/api/deleteFile/uploadFile/sample.jpg --> delete a file
To change limits you ccould edit application.properties
- spring.servlet.multipart.max-file-size=1028KB -> Limits to store
- spring.servlet.multipart.max-request-size=1028KB -> Limits to rq
- Maven - Dependency Management
TBD
TBD
- **Christian Regner 👺 ** - Initial work - xtian
This project is licensed under the MIT License - see the LICENSE.md file for details
- Hat tip to anyone whose code was used
- Inspiration
- etc