Hello SO:
I have this view in an ASP.NET MVC application:
<%
var path = Path.Combine(HttpRuntime.AppDomainAppPath, "uploads");
foreach (var file in Directory.GetFiles(path).OrderBy(f => new FileInfo(f).Length))
{
var item = new FileInfo(file);
%>
<tr>
<td></td>
<td>
<%=Html.Encode(Path.GetFileName(item.Name))%>
</td>
<td>
<%=Html.Encode(Functions.FormatBytes(item.Length))%>
</td>
<td>
<%=Html.FileLink(item.Name)%>
</td>
</tr>
<% } %>
Is it possible to access my variable f
inside the loop, or is there some other way to do this so I do not have to dimension two instances of FileInfo(file)
?
Thanks!