PageRenderTime 37ms CodeModel.GetById 27ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/BlogEngine/BlogEngine.NET/Playground.aspx.cs

#
C# | 37 lines | 33 code | 2 blank | 2 comment | 1 complexity | 66dde1eab49c5c622b4102a3074e5469 MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Web;
 5using System.Web.UI;
 6using System.Web.UI.WebControls;
 7using BlogEngine.Core.Providers;
 8using BlogEngine.Core;
 9using BlogEngine.Core.FileSystem;
10public partial class Playground : System.Web.UI.Page
11{
12    protected void Page_Load(object sender, EventArgs e)
13    {
14        var directory = Blog.CurrentInstance.RootFileStore;
15        //directory.CreateSubdirectory("2012");
16        //directory.DeleteSubDirectory("2012");
17    }
18
19    protected void btnUpload_Click(object sender, EventArgs e)
20    {
21        var now = DateTime.Today;
22        var directory = Blog.CurrentInstance.RootFileStore;
23        directory = directory.CreateSubDirectory("2011");
24        directory = directory.CreateSubDirectory("07");
25        File file = BlogService.UploadFile(fileUpload.PostedFile.InputStream, fileUpload.PostedFile.FileName, directory, true);
26        hprLink.NavigateUrl = file.FileDownloadPath;
27        hprLink.Text = file.FileDescription;
28        if (file.IsImage)
29        {
30            img.Visible = true;
31            img.ImageUrl = file.AsImage.ImageUrl;
32        }
33        else
34            img.Visible = false;
35
36    }
37}