Download files from Database

  • 16 January 2019
  • 2 replies
  • 4 views

Hello all,

 

I would like to store documents, (i.e., .docx, .xlsx, .txt, etc), into a SQL table and allow the user to download the files from the k2 web app by clicking a link in the list view.  My attempts to do this have failed.  Below explains what i have done up to this point.  Also note worthy i don't want a user to upload any files.

 

My table structure:

11560iBB7549D143847476.png

 

Help would be most appreciated.  


2 replies

Badge +12

Hi Core 2, 


 


I have seen the following blog post in regards to this error, it doesn't seem to be a K2 error but more of an error based on SQL. Please have at following post below:


 


https://www.codeproject.com/Questions/296703/String-or-binary-data-would-be-truncated-The-state


 


It could be the case the case the datatype size does match with the database field attributes, so one way to go would be to increase the datatype size on the DB side. 


 


Do let me know if this helps.


 


Kind regards, 


 


Percy

Userlevel 6
Badge +16

Hi,


 


SQL Server Service doesn't support the VarBinary datatype, see link below. You might want to change to nvarchar(max).


Considerations section:


https://help.k2.com/onlinehelp/k2five/userguide/5.2/default.htm#ServiceBrokers/SQLServer/SQL-Server-Service.htm%3FTocPath%3DAdminister%7CK2%2520Management%7CIntegration%7CService%2520Types%7CSQL%2520Server%7C_____0


 

Reply