سؤال

Is there a configuration setting in BlogEngine.NET that allows me to have images, documents, etc.. go to a specific folder(s)? Currently, it creates folders based on Year, Month, Day of when the file is uploaded.

هل كانت مفيدة؟

المحلول

As of version 2.9 There is not a setting for specifying this path. The path is calculated in the following function in Admin/Posts/Add_Entry.aspx.cs. See the line var dirName = ...

protected void BtnUploadImageClick(object sender, EventArgs e)
{
    var dirName = string.Format("/{0}/{1}", DateTime.Now.ToString("yyyy"), DateTime.Now.ToString("MM"));
    var dir = BlogService.GetDirectory(dirName);
    var file = BlogService.UploadFile(txtUploadImage.PostedFile.InputStream, txtUploadImage.FileName, dir, true);

    txtContent.Text += string.Format("<img src=\"{0}image.axd?picture={1}\" />", Utils.RelativeWebRoot, Server.UrlEncode(file.AsImage.FilePath));
    txtRawContent.Text += string.Format("<img src=\"{0}image.axd?picture={1}\" />", Utils.RelativeWebRoot, Server.UrlEncode(file.AsImage.FilePath));
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top