diff --git a/pom.xml b/pom.xml
index d4c306bd..71c70cce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -465,9 +465,9 @@
3.0.2
- commons-fileupload
- commons-fileupload
- 1.5
+ org.apache.commons
+ commons-fileupload2-javax
+ 2.0.0-M2
commons-codec
diff --git a/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java b/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
index f9bcb262..23332575 100644
--- a/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
+++ b/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
@@ -82,7 +82,7 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
-import org.apache.commons.fileupload.MultipartStream;
+import org.apache.commons.fileupload2.core.MultipartInput;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.KeyNotFoundException;
import org.jclouds.blobstore.domain.Blob;
@@ -2051,8 +2051,10 @@ private void handlePostBlob(HttpServletRequest request,
String signature = null;
String algorithm = null;
byte[] payload = null;
- var multipartStream = new MultipartStream(is,
- boundary.getBytes(StandardCharsets.UTF_8), 4096, null);
+ var multipartStream = MultipartInput.builder()
+ .setBoundary(boundary.getBytes(StandardCharsets.UTF_8))
+ .setInputStream(is)
+ .get();
boolean nextPart = multipartStream.skipPreamble();
while (nextPart) {
String header = multipartStream.readHeaders();