Question

Saving file attachment in binary format

  • 7 October 2020
  • 5 replies
  • 70 views

Badge +7

I am trying to save an attached file from smartform into binary format to my SQL database. 


5 replies

Userlevel 2
Badge +5

Hi,

Im not sure if you can save file attachements as binary, but you can save file attachments as nvarchar(MAX) (see nvarchar.png). Type “Text” and “varchar” also seem to work. You can then download the file from a listview which you can put onto a form (see download.png). I assume you already created a advanced smart object and a service instance, if not here is a link on how to do so. Hope this helps.

 

Kind Regards

Prineel

Badge +7

Thank you for your response.

I am already saving into SQL but the default is based 64, I need to save it to binary as old/legacy application will use it.

 

 

Badge +7

Actual value in SQL

<collection><object><fields><field name='FileName'><value>AAAA-000013.xls</value></field><field name='FilePath'><value>70D16121FED732285230A531A26874CA\AAAA-000013.xls</value></field><field name='FileRequestData'><value></value></field><field name='FileDataURL'><value></value></field></fields></object></collection>

Userlevel 2
Badge +5

Hi,

I could not find much information on saving it as a binary, even when creating a advanced SMO it does not recognize the binary fields, but you can try and convert it through the “to binary” conversion function in workflows (see toBinary.png), and save/update it into your smartobject/sql as a nvarchar or text field , or maybe convert it in sql (something like these queries). 

 

Kind Regards 

Prineel

Userlevel 1
Badge +4

Actual value in SQL

<collection><object><fields><field name='FileName'><value>AAAA-000013.xls</value></field><field name='FilePath'><value>70D16121FED732285230A531A26874CA\AAAA-000013.xls</value></field><field name='FileRequestData'><value></value></field><field name='FileDataURL'><value></value></field></fields></object></collection>

As per xml, it look K2 store the physical file on inetpub directory. in folder 70D16121FED732285230A531A26874CA

Reply