Spring Boot File Upload API (Starter Project)
A production-ready Spring Boot starter project for handling file management with minimal setup.
This boilerplate includes APIs for uploading, downloading, deleting, and retrieving metadata of files, along with a Postman collection for instant testing.
If youโre a Java developer, student, or freelancer, this saves hours of setup time when building:
- Document storage systems
- Media servers
- Student/demo projects
- Freelance applications that need file handling
๐ Features
- Upload files via REST API
- Stream or download files with proper MIME type
- Delete files by name
- List all uploaded files
- Retrieve file metadata (size, type, last modified)
- Includes Postman collection for testing
๐ ๏ธ Tech Stack
- Java 21
- Spring Boot 3.5.4
- Maven
โ๏ธ Setup Instructions
1. Prerequisites
- Install Java 21+
- Install Maven
- Use an IDE like IntelliJ IDEA, Eclipse, or VS Code with Java support
2. Unzip & Open Project
- Download the provided ZIP after purchase
- Extract it, e.g. to:
C:/projects/springboot-file-upload-api - Open as a Maven project in your IDE
3. Update Configuration
Edit src/main/resources/application.properties as per your needs:
# Server Configuration
spring.application.name=springboot-file-upload-api
server.port=8000
# File Configuration
spring.servlet.multipart.max-file-size=50MB
spring.servlet.multipart.max-request-size=50MB
# Local storage path (auto-created if missing)
upload.path=D://test-file-upload-folder
4. Run the Project
Run with Maven:
mvn spring-boot:run
Or from IDE โ Run as โ Spring Boot App
Server runs at:
๐ http://localhost:8000
๐ก API Endpoints
๐ผ Upload FilePOST /file โ Uploads a file and returns a unique filename
Example:
curl -F "file=@logo.png" http://localhost:8000/file
๐ฅ Stream/Download FileGET /file/{filename} โ Streams or downloads file
โ Delete FileDELETE /file/{filename} โ Permanently deletes file
๐ List All FilesGET /file/list โ Returns array of uploaded file names
โน๏ธ Get File InfoGET /file/info/{filename} โ Returns file metadata
๐ฌ Postman Collection
Included: file-upload-api.postman_collection.json
Simply import it into Postman to test APIs immediately.
๐ Notes
- Authentication is not included (can be added with Spring Security).
- File storage path is configurable via
application.properties. - Files are stored locally.
๐ License
Released under the MIT License โ free for personal and commercial use.
๐ฏ Who Is This For?
- Java/Spring Boot developers needing a file upload boilerplate
- Students working on assignments/projects
- Freelancers delivering file handling functionality to clients
โจ With this starter project, you can integrate file handling into your Spring Boot applications in minutes instead of hours.