-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support to list all multipart uploads but without storing them locally #43127
Comments
/cc @FroMage (rest), @stuartwdouglas (rest) |
An alternative is to use |
When using |
Do you have a sample I can look at? |
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Path("/upload-files")
public void uploadFiles(MultipartFormDataInput input) throws IOException {
int partCount = 0;
for (var entry : input.getValues().entrySet()) {
Log.infof("Part #%d:", ++partCount);
Log.info("\t- Name: " + entry.getKey());
for (var formValue : entry.getValue()) {
boolean isFileItem = formValue.isFileItem();
Log.info("\t- IsFile?: " + isFileItem);
if (isFileItem) {
var fileItem = formValue.getFileItem();
boolean isInMemory = fileItem.isInMemory();
Log.info("\t- isInMemory?: " + isInMemory);
if (isInMemory) {
byte[] bytes = ((ByteArrayInputStream) fileItem.getInputStream()).readAllBytes();
Log.info("\t- byte[] length: " + bytes.length);
} else {
Log.info("\t- File path: " + fileItem.getFile());
}
} else {
Log.info("\t- String value: " + formValue.getValue());
}
}
}
} |
Thanks. And the request you are making is? |
I am using Postman to submit the request: The console output:
|
Thanks. I'll have a look soon |
Anything that contains a |
Is there a way to prevent saving file locally even if it has a name? |
There is not, but I guess we could look into making it happen... |
Description
Currently, one can list all file uploads in a
multipart/form-data
request, as follows:However, this will store the files in a temp directory.
Alternatively, one can define multiple parameters:
but this is not a dynamic listing.
So this is an enhancement request to support listing them but without storing them locally on the filesystem (i.e.
fileItem.isInMemory() is true
):Implementation ideas
No response
The text was updated successfully, but these errors were encountered: