Question

Attachment control to open files in browser

  • 20 March 2023
  • 1 reply
  • 156 views

Badge +2

Hi All,

Is there a way to open the attachments in browser rather than downloading it ? 

File stored in SQL table. K2 attachment control to add/remove attachment.

Tx,

Zeeshan


1 reply

Userlevel 2
Badge +7

It depends on the file type:

 

If they are plain text, PDFs or images you can use DataURLs . To do this extract the base64 portion of the file xml and add it to the data URL with the correct media type

If you are using SharePoint Online you can embed Office Documents in an iFrame. 

It is also worth googling for a JavaScript library that can help you with this as there are a number of possible options to tackle this and you could inject one of those into your form to help.

Reply