Repository: quarkusio/quarkus
Issue: REST Reactive Client: PartFilename annotation doesn't work if member is anything else than java.io.File

### Describe the bug

I have tested the new @PartFilename annotation in the REST Reactive client (Quarkus 2.7.0.CR1). See issue #22658 
However, the annotation seems to work only if the respective annotated member is of type java.io.File. I tested with java.nio.Buffer and java.lang.String. If one of these two types is used, the file name is not transferred.

Works as expected:
```java
public class OurForm {
  @FormParam("files")
  @PartFilename("document.txt")
  @PartType(MediaType.TEXT_PLAIN)
  private File documentFile;
}
```

Doesn't work:

```java
public class OurForm {
  @FormParam("files")
  @PartFilename("document.txt")
  @PartType(MediaType.TEXT_PLAIN)
  private String documentFile;
}

public class OurForm {
  @FormParam("files")
  @PartFilename("document.txt")
  @PartType(MediaType.TEXT_PLAIN)
  private Buffer documentFile;
}
```

### Expected behavior

_No response_

### Actual behavior

_No response_

### How to Reproduce?

_No response_

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

_No response_

### GraalVM version (if different from Java)

2.7.0.CR1

### Quarkus version or git rev

_No response_

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

_No response_

### Additional information

_No response_

Changed files:
extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java
independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartForm.java
extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/multipart/MultipartFilenameTest.java

diff --git a/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java b/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java
index 8f79b818fad..db778f22b64 100644
--- a/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java
+++ b/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java
@@ -1627,7 +1627,7 @@ private void handleMultipartField(String formParamName, String partType, String
 
         // we support string, and send it as an attribute unconverted
         if (type.equals(String.class.getName())) {
-            addString(ifValueNotNull, multipartForm, formParamName, partFilename, fieldValue);
+            addString(ifValueNotNull, multipartForm, formParamName, partType, partFilename, fieldValue);
         } else if (type.equals(File.class.getName())) {
             // file is sent as file :)
             ResultHandle filePath = ifValueNotNull.invokeVirtualMethod(
@@ -1660,7 +1660,7 @@ private void handleMultipartField(String formParamName, String partType, String
                     parameterAnnotations, methodIndex);
             BytecodeCreator parameterIsStringBranch = checkStringParam(ifValueNotNull, convertedFormParam,
                     restClientInterfaceClassName, errorLocation);
-            addString(parameterIsStringBranch, multipartForm, formParamName, partFilename, convertedFormParam);
+            addString(parameterIsStringBranch, multipartForm, formParamName, null, partFilename, convertedFormParam);
         }
     }
 
@@ -1743,13 +1743,27 @@ private ResultHandle partFilenameHandle(BytecodeCreator methodCreator, String pa
     }
 
     private void addString(BytecodeCreator methodCreator, AssignableResultHandle multipartForm, String formParamName,
-            String partFilename, ResultHandle fieldValue) {
-        methodCreator.assign(multipartForm,
-                methodCreator.invokeVirtualMethod(
-                        MethodDescriptor.ofMethod(QuarkusMultipartForm.class, "attribute", QuarkusMultipartForm.class,
-                                String.class, String.class, String.class),
-                        multipartForm, methodCreator.load(formParamName), fieldValue,
-                        partFilenameHandle(methodCreator, partFilename)));
+            String partType, String partFilename, ResultHandle fieldValue) {
+        if (MediaType.APPLICATION_OCTET_STREAM.equalsIgnoreCase(partType)) {
+            methodCreator.assign(multipartForm,
+                    // MultipartForm#stringFileUpload(String name, String filename, String content, String mediaType);
+                    methodCreator.invokeVirtualMethod(
+                            MethodDescriptor.ofMethod(QuarkusMultipartForm.class, "stringFileUpload",
+                                    QuarkusMultipartForm.class, String.class, String.class, String.class,
+                                    String.class),
+                            multipartForm,
+                            methodCreator.load(formParamName),
+                            partFilename != null ? methodCreator.load(partFilename) : methodCreator.loadNull(),
+                            fieldValue,
+                            methodCreator.load(partType)));
+        } else {
+            methodCreator.assign(multipartForm,
+                    methodCreator.invokeVirtualMethod(
+                            MethodDescriptor.ofMethod(QuarkusMultipartForm.class, "attribute", QuarkusMultipartForm.class,
+                                    String.class, String.class, String.class),
+                            multipartForm, methodCreator.load(formParamName), fieldValue,
+                            partFilenameHandle(methodCreator, partFilename)));
+        }
     }
 
     private void addMultiAsFile(BytecodeCreator methodCreator, AssignableResultHandle multipartForm, String formParamName,
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/multipart/MultipartFilenameTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/multipart/MultipartFilenameTest.java
index 22c7a845d41..9723f6f3841 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/multipart/MultipartFilenameTest.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/multipart/MultipartFilenameTest.java
@@ -58,9 +58,18 @@ void shouldUseFileNameFromAnnotation() throws IOException {
         File file = File.createTempFile("MultipartTest", ".txt");
         file.deleteOnExit();
 
-        ClientForm2 form = new ClientForm2();
+        ClientFormUsingFile form = new ClientFormUsingFile();
         form.file = file;
-        assertThat(client.postMultipartWithPartFilename(form)).isEqualTo(ClientForm2.FILE_NAME);
+        assertThat(client.postMultipartWithPartFilename(form)).isEqualTo(ClientFormUsingFile.FILE_NAME);
+    }
+
+    @Test
+    void shouldUseFileNameFromAnnotationUsingString() {
+        Client client = RestClientBuilder.newBuilder().baseUri(baseUri).build(Client.class);
+
+        ClientFormUsingString form = new ClientFormUsingString();
+        form.file = "file content";
+        assertThat(client.postMultipartWithPartFilenameUsingString(form)).isEqualTo("clientFile:file content");
     }
 
     @Test
@@ -111,6 +120,13 @@ public String upload(@MultipartForm FormData form) {
             return form.myFile.fileName();
         }
 
+        @POST
+        @Path("/using-string")
+        @Consumes(MediaType.MULTIPART_FORM_DATA)
+        public String uploadWithFileContentUsingString(@MultipartForm FormData form) throws IOException {
+            return form.myFile.fileName() + ":" + Files.readString(form.myFile.uploadedFile());
+        }
+
         @POST
         @Path("/file-content")
         @Consumes(MediaType.MULTIPART_FORM_DATA)
@@ -166,7 +182,12 @@ public interface Client {
 
         @POST
         @Consumes(MediaType.MULTIPART_FORM_DATA)
-        String postMultipartWithPartFilename(@MultipartForm ClientForm2 clientForm);
+        String postMultipartWithPartFilename(@MultipartForm ClientFormUsingFile clientForm);
+
+        @POST
+        @Path("/using-string")
+        @Consumes(MediaType.MULTIPART_FORM_DATA)
+        String postMultipartWithPartFilenameUsingString(@MultipartForm ClientFormUsingString clientForm);
 
         @POST
         @Path("/file-content")
@@ -190,7 +211,7 @@ public static class ClientForm {
         public File file;
     }
 
-    public static class ClientForm2 {
+    public static class ClientFormUsingFile {
         public static final String FILE_NAME = "clientFile";
 
         @FormParam("myFile")
@@ -198,4 +219,13 @@ public static class ClientForm2 {
         @PartFilename(FILE_NAME)
         public File file;
     }
+
+    public static class ClientFormUsingString {
+        public static final String FILE_NAME = "clientFile";
+
+        @FormParam("myFile")
+        @PartType(MediaType.APPLICATION_OCTET_STREAM)
+        @PartFilename(FILE_NAME)
+        public String file;
+    }
 }
diff --git a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartForm.java b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartForm.java
index 55c8db8783a..026c96dbd68 100644
--- a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartForm.java
+++ b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartForm.java
@@ -67,6 +67,11 @@ public QuarkusMultipartForm textFileUpload(String name, String filename, Buffer
         return this;
     }
 
+    @SuppressWarnings("unused")
+    public QuarkusMultipartForm stringFileUpload(String name, String filename, String content, String mediaType) {
+        return textFileUpload(name, filename, Buffer.buffer(content), mediaType);
+    }
+
     @SuppressWarnings("unused")
     public QuarkusMultipartForm binaryFileUpload(String name, String filename, String pathname, String mediaType) {
         parts.add(new QuarkusMultipartFormDataPart(name, filename, pathname, mediaType, false));