User632428103 posted
Hello,
in your api controller add a get method who retrieve the files from the server as this => it's a sample
public IEnumerable<string> Get()
{
string dirPath = Path.Combine(ConfigurationManager.AppSettings["SERVER FILE PATH "].ToString());
List<string> files = new List<string>();
DirectoryInfo dirInfo = new DirectoryInfo(dirPath);
foreach (FileInfo fInfo in dirInfo.GetFiles())
{
files.Add(fInfo.Name);
}
return files.ToArray();
}
add on the view , add a call jquery for example and display them
<script type="text/javascript">
$.getJSON('api/apiName', function (data)
{
var fileList = $("#files");
// browse over file
$.each(data, function (key, val) {
var row = ('<li>' + val +'</li>');
$("#files").append(row);
});
});
</script>
<ul id="files">
</ul>
don't forget to add the jquery library