Getting the source file path from attachment control

  • 6 September 2019
  • 2 replies
  • 140 views

I am building a K2 Smart Form on K2 Cloud. In my form, I want to let user navigate to file system, select a file but just get the source path (from user's local file system) of file selected by user in attachment control. I really do not need actual file attachment.

Is this possible? If there is another way to get the same results without using file attachment control.

 

Ajay

 

 


2 replies

Hi  @ajay_mandke


 


At the moment there's no out of the box functionality,


As suggested please dive into(http://help.k2.com/onlinehelp/K2Five/DevRef/5.3/default.htm#Runtime/SmO-Client/UpdloadFile.html), alter the file upload to pass File string/path data to the client so.


 


Additionally had read through the viability of such in .js-JavaScript cannot typically access local files in new browsers, but the XMLHttpRequest object can be used to read files. So it is actually Ajax (and not Javascript) which is reading the file.


 


The possibility of the above ,please checkout with the File readerAPI(https://w3c.github.io/FileAPI/#dfn-filereader)The FileReader type has a single job: to read data from a file and store it in a JavaScript variable. The API is intentionally designed to be similar to XMLHttpRequest since both are loading data from an external (outside of the browser) resource.


 


Best Reference:-(http://help.k2.com/onlinehelp/K2Five/DevRef/5.3/default.htm#Runtime/SmO-Client/ClientSamples.htm%3FTocPath%3DRuntime%2520APIs%2520and%2520Services%7CSmartObjects%7CSmartObject%2520Client%2520API%7CSmartObject%2520Client%2520Samples%2520and%2520practices%7C_____0)


 


Hope your issue get resolved.


 


Kind regards;


Widson.


 

Badge +6

Since this question is posted under K2 Cloud, I am assuming that you are using K2 Cloud. So in the context of SaaS, storing local file paths would be useless. I think you need to rethink the design and use SharePoint Online or Dropbox or Box as your Line of Business storage. If you use any of these online storage LOBs, you can simple store a reference to the file.

Reply