Hi folks,
i have one directory with different kind of files like html files,csv files,text files and subfolders.
but here requirement is,how to retrieve only text files and add it to array in javascript with the support of html.
Thanks in advance
Regards
Ravi Gaddam
Ravi GaddamPosted Nov 28, 2013, 8:53 AM
Thanks for reply
i need code in javascript itself, because,my system doesn`t have any softwares like java and .net
Thanks
Ravi gaddam
Kunal VaishyaPosted Nov 28, 2013, 8:04 AM
String DirPath = Application.StartupPath + "\\New folder";
Or
String DirPath = Server.MapPath("/New folder");
Logic -
System.IO.FileInfo[] FileInfo ;
System.IO.DirectoryInfo DirInfo = new System.IO.DirectoryInfo(DirPath);
// You will Get the Array in "FileInfo" Object
FileInfo = DirInfo.GetFiles();
String str = "";
for (int i = 0; i < FileInfo.Length - 1; i++)
{
str =FileInfo[i].Name;
}