Switch from commons-fileupload to commons-fileupload-jakarta-servlet6
I need to change my fileupload-integration to the jakarta6-version. The old code is . Using the new version I have this constructor:
new JakartaServletFileUpload<FileItem<I>, FileItemFactory<I>>();
. How to use the constructor properly?17 Replies
⌛
This post has been reserved for your question.
Hey @Peter Rader! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Hm, can you be more specific?
Well that page has examples for using that constructor
I think the first code example is pretty much what you want
I found the example for constructor
JakartaServletDiskFileUpload
but I need JakartaServletFileUpload
(without disk in the name).Just use your own
ItemFactory
?
And for that you need to decide what kind of FileItem
you wantYou mean
FileItemFactory
?
I think there must be an easier way. To create my own factory for simple upload is a overkill.If you want a
FileItemFactory
, use that
but idk whether you want one or whether you want something custom
if you want a FileItemFactory
, you can probably also use JakartaServletDiskFileUpload
?Why should I use JakartaServletDiskFileUpload instead of JakartaServletFileUpload?
If you want to save it to disk, that already has some logic implemented?
I dont like to save all. I only like to save the .ova file.
Is the no-args constructor not applicable?
and only <?> generics?
I think if you want to use something that doesn't save it on disk, you either need the no-args constructor or a custom factory
start with them and change them as necessary
Baeldung
Spring and Apache FileUpload | Baeldung
A quick and practical guide to using Apache FileUpload with Spring.
section 4. might be interesting
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.