Last active
May 29, 2025 00:03
-
-
Save mike-seger/7cfd44c9c3c61e8a39e03cd2b13152ff to your computer and use it in GitHub Desktop.
correct upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.swagger.v3.oas.annotations.Operation | |
import io.swagger.v3.oas.annotations.media.Content | |
import io.swagger.v3.oas.annotations.media.Schema | |
import io.swagger.v3.oas.annotations.parameters.RequestBody | |
import org.springframework.http.MediaType | |
import org.springframework.web.bind.annotation.* | |
import org.springframework.web.multipart.MultipartFile | |
import java.util.zip.ZipInputStream | |
@RestController | |
@RequestMapping("/api") | |
class ZipController { | |
@Operation( | |
summary = "Upload zip file and list contents", | |
requestBody = RequestBody( | |
required = true, | |
content = [Content( | |
mediaType = MediaType.MULTIPART_FORM_DATA_VALUE, | |
schema = Schema(implementation = UploadForm::class) | |
)] | |
) | |
) | |
@PostMapping("/uploadZip", consumes = [MediaType.MULTIPART_FORM_DATA_VALUE]) | |
fun uploadZip(@RequestParam("file") file: MultipartFile): List<String> { | |
class UploadForm( | |
@field:Schema(type = "string", format = "binary", description = "Zip file to upload") | |
val file: MultipartFile? = null | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment