我正在开发一个ASP.NET MVC应用程序,我需要一个包含图像(包括子文件夹)的每个用户文件夹。我正在寻找一种简单的方式,允许管理这样的图片(文件夹上传,单一图像上传,删除,显示)。
galery本身并不是应用程序的关键功能,也不需要花哨(不需要评论等等)。
现在,我正在考虑为每个用户的FTP帐户。然而,
还是有更简单的方法?
发布于 2012-05-28 09:18:22
对于文件夹的大小,请使用代码
Vb.Net
Dim Klasor As DirectoryInfo = New DirectoryInfo(Server.MapPath("~/Content"))
Dim Boyut As Decimal
For Each dr In Klasor.GetFiles
Boyut += dr.Length
NextVb到C# :(
DirectoryInfo Klasor = new DirectoryInfo(Server.MapPath("~/Content"));
decimal Boyut = default(decimal);
foreach (object dr_loopVariable in Klasor.GetFiles) {
dr = dr_loopVariable;
Boyut += dr.Length;
}关闭对http上文件夹的访问,使用授权成员资格。查询只接受成员自己的文件夹。使用授权进行读写操作。
样本阅读: Vb.Net
Function FileReturn() As FileResult
Dim fi As New FileInfo(Server.MapPath("~/UserFiles/{UserID}/me.png"))
Return File(fi.OpenRead, "image/png")
//and for download Return File(fi.OpenRead, "image/png").FileDownloadName("me.png download") or Return File(fi.OpenRead, "image/png","meee")
End Function转换C#:
public FileResult FileReturn()
{
FileInfo fi = new FileInfo(Server.MapPath("~/UserFiles/{UserID}/me.png"));
return File(fi.OpenRead, "image/png");
//and for download Return File(fi.OpenRead, "image/png").FileDownloadName("me.png download") or Return File(fi.OpenRead, "image/png","meee")
}我很抱歉vb.net代码
https://stackoverflow.com/questions/10781541
复制相似问题