This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Add file to Files Client method

GVB - Friday, October 16, 2015 5:31 AM:

Hi,

I'm writing a client method to open a file brower and read a text file line by line until the end of file.
Loop through the text file and use the string from each line to create File item in the Files.

Right now, I'm able to open file brower to select a text file, but could'nt read line by line, instead reads all text.
code:

var inn = this.newInnovator();
var fileName = top.aras.vault.SelectFile();
var str = top.aras.vault.ReadText(fileName);
// need a way to loop through the file and read line by line.

I have also written the code to create file item in the Files.
Code:
File=inn.newItem("File","add");
File.setProperty("filename","aaa.pdf");
try{
File.attachPhysicalFile("C:\file_upload\aaa.pdf");
}catch(e){alert("Error while Attaching file:"+e);}
Res=File.apply();
return this;
// the filename and physicalPath are hardcoded. I would like to pass the str got from the text file to physicalpath and part of string to the filename instead.

sample text file content:
C:aaa.pdf
C:bb.pdf

filename to be passed:
aaa.pdf
bbb.pdf

physical path to be passed:
C:aaa.pdf
C:bb.pdf

Any sugestions would be helpful.
Thanks.

 



Amruta - Wednesday, October 28, 2015 5:20 AM:

Hi,

Try with file check in and check out Aras API

Regards

Amruta