Misunderstanding in downloading file

Hi colleagues.

Screenshot_20230117_030649
If you see above attached picture, have a trouble to download file and received such kind of exception. Actually code is like this in the StandardDetailView<T>:

InputStream inputStream = new FileInputStream("excel-file-path");
FileRef fileRef = fileStorage.saveStream("name.xlsx", inputStream);
fileTransferService.downloadAndWriteResponse(fileRef, fileStorage.getStorageName(), false, RequestContext.getResponse());

Can you provide most suitable way to download any created file(example: from apache poe to insert values) programmatically.

Thanks in advance!

Hi!
Have you tried it Downloading and Displaying Files :: Jmix Documentation?

1 Like

Hi, Abdulmalik!
Thank you for your question. We need a little more information to solve your problem.

Can you please answer the following questions?

  1. Do you use FlowUI or ClassicUI?
  2. What version of the Jmix Framework are you using?
  3. Have you tried the methods described in the Jmix documentation? @oman already provided the link.

Answering these questions will help us better understand your problem and help you more quickly.

Regards,
Dmitriy

@oman 's solution works for me. Thanks a lot!