Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » FileChooser and Accepted File Extensions
FileChooser and Accepted File Extensions [message #1857436] Tue, 07 February 2023 12:41 Go to next message
Eclipse UserFriend
Hi,

I have a problem with the FileChooser and would appreciate any advice.

It seems that only certain file extensions are allowed to be used. These are defined in the class UploadRequestHandler.DEFAULT_VALID_FILE_EXTENSIONS (org.eclipse.scout.rt.ui.html.json). However, I also need to work with files that have other than the defined extensions.

In the interface IUploadable.getAcceptedUploadFileExtensions() it is apparently also possible to enter file extensions.

Can anyone give me a hint as to where and how to intervene in order to also use other file extensions.

Many thanks
Re: FileChooser and Accepted File Extensions [message #1857446 is a reply to message #1857436] Wed, 08 February 2023 01:03 Go to previous messageGo to next message
Eclipse UserFriend
You can override the default implementation with your own implementation:

@Replace
public class OwnUploadRequestHandler extends UploadRequestHandler {

  @Override
  protected Set<String> getValidFileExtensionsDefault() {
    return Collections.singleton("zip");
  }
}


Above implementation would only allow "zip" files; from reading the code it should also be possible to return an empty set to allow any extension (even though might not be recommended).
Re: FileChooser and Accepted File Extensions [message #1857450 is a reply to message #1857446] Wed, 08 February 2023 06:21 Go to previous messageGo to next message
Eclipse UserFriend
it worked. thanks a lot Matthias!
Re: FileChooser and Accepted File Extensions [message #1857451 is a reply to message #1857450] Wed, 08 February 2023 06:44 Go to previous messageGo to next message
Eclipse UserFriend
I have a supplementary question: When I use getConfiguredFileExtensions, it seems that my specific file extensions are filtered out. I could not find where this is done. Where do I have to intervene for this?
Re: FileChooser and Accepted File Extensions [message #1857707 is a reply to message #1857451] Tue, 21 February 2023 22:59 Go to previous messageGo to next message
Eclipse UserFriend
When using

 @Override
 protected List<String> getConfiguredFileExtensions() {
  return Collections.singletonList("zip");
}


only ZIP files should be allowed (see OwnUploadRequestHandler above which might need to be adjusted too).
Re: FileChooser and Accepted File Extensions [message #1857714 is a reply to message #1857707] Wed, 22 February 2023 04:24 Go to previous messageGo to next message
Eclipse UserFriend
thanks but unfortunately that does not work. Having a file with an extension ".zzz" and using the getConfiguredFileExtensions as shown, is not showing the files with that extension.

It only works with the given extensions (UploadRequestHandler.DEFAULT_VALID_FILE_EXTENSIONS)
Re: FileChooser and Accepted File Extensions [message #1857715 is a reply to message #1857714] Wed, 22 February 2023 05:03 Go to previous messageGo to next message
Eclipse UserFriend
Did you adjust the method getConfiguredFileExtensions and add a custom UploadRequestHandler with the new file extension .zzz?

How do you try to upload the file? File chooser browser dialog? Is the file shown in the file chooser and just not uploaded? Or is it not even shown in the file chooser?
Re: FileChooser and Accepted File Extensions [message #1857716 is a reply to message #1857715] Wed, 22 February 2023 05:13 Go to previous message
Eclipse UserFriend
yes I did.

If I use getConfiguredFileExtensions with ".zzz" the file will not be shown in the file chooser.
If I use getConfiguredFileExtensions with null, all files, inlcuding the ones with extension ".zzz", will be shown and I can choose and upload a file with ".zzz" extension
Previous Topic:TablePage pagination
Next Topic:Cannot find the source of Javascript error
Goto Forum:
  


Current Time: Sat Jun 21 16:23:59 EDT 2025

Powered by FUDForum. Page generated in 0.04660 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top