Skip to content
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

Upload Field #6629

Open
felixoi opened this issue Sep 6, 2024 · 6 comments
Open

Upload Field #6629

felixoi opened this issue Sep 6, 2024 · 6 comments

Comments

@felixoi
Copy link

felixoi commented Sep 6, 2024

Describe your motivation

Currently it is possible to upload files using the upload component. Still like it's implemented it's not as easy to use it in forms with a binder.

Describe the solution you'd like

A first class upload component which is bindable.

Describe alternatives you've considered

Using addons and other external implementations.

Additional context

@felixoi felixoi added the enhancement New feature or request label Sep 6, 2024
@Legioth
Copy link
Member

Legioth commented Sep 6, 2024

What would the value type of that field be? Just based on a quick overview I could imagine either of byte[], InputStream, OutputStream, String (filesystem path of an uploaded file) or java.sql.Blob and I'm quite sure there are also other candidates if you dig slightly deeper.

@felixoi
Copy link
Author

felixoi commented Sep 6, 2024

That's actually a good question. From a simple perspective I'd have expected byte[]. Still I can understand why you are listing the others too.

@Legioth
Copy link
Member

Legioth commented Sep 6, 2024

The problem with byte[] is that it forces always keeping the data in memory. I wonder if Supplier<byte[]> would be a decent way of working around that without making simple cases too cumbersome?

@mshabarov
Copy link
Contributor

Deserves perhaps a new component that implements HasValue and provides a generic value type, but also allows to set a supplier that converts the InputStream (stream resource output) to the generic type of this component.

@mshabarov mshabarov transferred this issue from vaadin/flow Sep 10, 2024
@web-padawan
Copy link
Member

This was previously requested in #1571. See also #1571 (comment) for how to wrap Upload in CustomField.

@felixoi
Copy link
Author

felixoi commented Sep 10, 2024

I know that I can wrap it and we have it in live in action. It's always a struggle tho to update it and just maintain it (also for multi file uploads). As of my knowledge the majority of huge frameworks have this functionality just out of the box, so that's why I'm requesting it again. It's simple to build nice form with vaadin but at the point you want to include file uploads, it's always a struggle (we're having multiple vaadin apps live in production which have a lot of forms).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants