cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5: Attachment Download functionality

chandansb
Active Contributor
0 Kudos

Hello Experts,

I have a requirement to fetch the attachments into my SAPUI5 app. Below is the structure of the ODATA service that I will be using to achieve it.

<PATH>Attachment('<objectid>')

This will give me details about the attachment (like createdby, Name, DocumentLink, etc)

The document link will be used to download this attachment into the local system. Structure for this will be as below:

<PATH>Attachment('<objectid>')/Binary/$value

Before starting with this additional functionality, I want to understand how will I approach with this requirement. I can display the name of the attachment, but how will I trigger this download? Moreover when I test the attachment download Service, an attachment gets downloaded with the default file name as "value" without any extension to this file. So second hurdle I see how will manipulate to rename the TO BE DOWNLOADED file with it's actual name and it's actual extn?

Example, if the attachment name is My Attachment.pdf, it should be downloaded with it's original name (that is My Attachment.pdf), but it is downloaded as value (without extension)

Kindly help me understand this.

Thanks & Regards,

Chandan

Accepted Solutions (1)

Accepted Solutions (1)

antonette_oberholster
Active Contributor

Hallo Chandan

This is a nice post . You can also read this one and this one.

Hope they help

Antonette

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Chandan Bankar,

Did you find a way to solve the issue you reported? Can you share with the community?

@Antonette, reading all those posts didn't solve the issue both me and Bankar are facing: we want a way to rename a file on client side , so when the user downloads a file it does not appear "$VALUE" with no extension but a "normal" file, with a propper name and extension.

Thank you all,

Hugo

UPDATE: the solution for this is quite simple once you have to handle this on the server side: