Hooked up IFileSystem to the file uploader / IFile

This commit is contained in:
Matt@MBP13-PC
2012-08-14 09:11:49 -01:00
parent 524244d1ec
commit e2274b7892
13 changed files with 258 additions and 152 deletions

View File

@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Umbraco.Core.IO
{
public abstract class AbstractFileSystem : IFileSystem
{
public abstract IEnumerable<string> GetDirectories(string path);
public abstract void DeleteDirectory(string path);
public abstract void DeleteDirectory(string path, bool recursive);
public abstract bool DirectoryExists(string path);
public abstract void AddFile(string path, Stream stream);
public abstract void AddFile(string path, Stream stream, bool overrideIfExists);
public abstract IEnumerable<string> GetFiles(string path);
public abstract IEnumerable<string> GetFiles(string path, string filter);
public abstract Stream OpenFile(string path);
public abstract void DeleteFile(string path);
public abstract bool FileExists(string path);
public abstract string GetRelativePath(string fullPathOrUrl);
public abstract string GetFullPath(string path);
public abstract string GetUrl(string path);
public virtual long GetSize(string path)
{
var s = OpenFile(path);
var size = s.Length;
s.Close();
return size;
}
public abstract DateTimeOffset GetLastModified(string path);
public abstract DateTimeOffset GetCreated(string path);
}
}

View File

@@ -6,32 +6,37 @@ namespace Umbraco.Core.IO
{
internal interface IFileSystem
{
IEnumerable<string> GetDirectories(string path);
void DeleteDirectory(string path);
void DeleteDirectory(string path, bool recursive);
IEnumerable<string> GetFiles(string path);
IEnumerable<string> GetFiles(string path, string filter);
IEnumerable<string> GetDirectories(string path);
string GetFullPath(string path);
string GetUrl(string path);
void DeleteFile(string path);
bool FileExists(string path);
bool DirectoryExists(string path);
void AddFile(string path, Stream stream);
void AddFile(string path, Stream stream, bool overrideIfExists);
IEnumerable<string> GetFiles(string path);
IEnumerable<string> GetFiles(string path, string filter);
Stream OpenFile(string path);
void DeleteFile(string path);
bool FileExists(string path);
string GetRelativePath(string fullPathOrUrl);
string GetFullPath(string path);
string GetUrl(string path);
long GetSize(string path);
DateTimeOffset GetLastModified(string path);
DateTimeOffset GetCreated(string path);

View File

@@ -7,7 +7,7 @@ using System.Web;
namespace Umbraco.Core.IO
{
internal class PhysicalFileSystem : IFileSystem
internal class PhysicalFileSystem : AbstractFileSystem
{
private readonly string _rootPath;
private readonly string _rootUrl;
@@ -33,14 +33,14 @@ namespace Umbraco.Core.IO
_rootUrl = rootUrl;
}
public IEnumerable<string> GetDirectories(string path)
public override IEnumerable<string> GetDirectories(string path)
{
path = EnsureTrailingSeparator(GetFullPath(path));
try
{
if (Directory.Exists(path))
return Directory.EnumerateDirectories(path).Select(MakeRelativePath);
return Directory.EnumerateDirectories(path).Select(GetRelativePath);
}
catch (UnauthorizedAccessException ex)
{ }
@@ -50,12 +50,12 @@ namespace Umbraco.Core.IO
return Enumerable.Empty<string>();
}
public virtual void DeleteDirectory(string path)
public override void DeleteDirectory(string path)
{
DeleteDirectory(path, false);
}
public void DeleteDirectory(string path, bool recursive)
public override void DeleteDirectory(string path, bool recursive)
{
if (!DirectoryExists(path))
return;
@@ -68,17 +68,17 @@ namespace Umbraco.Core.IO
{ }
}
public bool DirectoryExists(string path)
public override bool DirectoryExists(string path)
{
return Directory.Exists(GetFullPath(path));
}
public void AddFile(string path, Stream stream)
public override void AddFile(string path, Stream stream)
{
AddFile(path, stream, true);
}
public void AddFile(string path, Stream stream, bool overrideIfExists)
public override void AddFile(string path, Stream stream, bool overrideIfExists)
{
if (FileExists(path) && !overrideIfExists)
throw new InvalidOperationException(string.Format("A file at path '{0}' already exists",
@@ -90,19 +90,19 @@ namespace Umbraco.Core.IO
stream.CopyTo(destination);
}
public IEnumerable<string> GetFiles(string path)
public override IEnumerable<string> GetFiles(string path)
{
return GetFiles(path, "*.*");
}
public IEnumerable<string> GetFiles(string path, string filter)
public override IEnumerable<string> GetFiles(string path, string filter)
{
path = EnsureTrailingSeparator(GetFullPath(path));
try
{
if (Directory.Exists(path))
return Directory.EnumerateFiles(path, filter).Select(MakeRelativePath);
return Directory.EnumerateFiles(path, filter).Select(GetRelativePath);
}
catch (UnauthorizedAccessException ex)
{ }
@@ -112,12 +112,12 @@ namespace Umbraco.Core.IO
return Enumerable.Empty<string>();
}
public Stream OpenFile(string path)
public override Stream OpenFile(string path)
{
return File.OpenRead(GetFullPath(path));
}
public void DeleteFile(string path)
public override void DeleteFile(string path)
{
if (!FileExists(path))
return;
@@ -130,33 +130,44 @@ namespace Umbraco.Core.IO
{ }
}
public bool FileExists(string path)
public override bool FileExists(string path)
{
return File.Exists(GetFullPath(path));
}
public string GetFullPath(string path)
public override string GetRelativePath(string fullPathOrUrl)
{
var relativePath = fullPathOrUrl
.TrimStart(_rootUrl)
.Replace('/', Path.DirectorySeparatorChar)
.TrimStart(_rootPath)
.TrimStart(Path.DirectorySeparatorChar);
return relativePath;
}
public override string GetFullPath(string path)
{
return !path.StartsWith(_rootPath)
? Path.Combine(_rootPath, path)
: path;
}
public string GetUrl(string path)
public override string GetUrl(string path)
{
return _rootUrl.TrimEnd("/") + "/" + path
.TrimStart(Path.DirectorySeparatorChar)
.Replace(Path.DirectorySeparatorChar, '/');
}
public DateTimeOffset GetLastModified(string path)
public override DateTimeOffset GetLastModified(string path)
{
return DirectoryExists(path)
? new DirectoryInfo(GetFullPath(path)).LastWriteTimeUtc
: new FileInfo(GetFullPath(path)).LastWriteTimeUtc;
}
public DateTimeOffset GetCreated(string path)
public override DateTimeOffset GetCreated(string path)
{
return DirectoryExists(path)
? Directory.GetCreationTimeUtc(GetFullPath(path))
@@ -165,14 +176,6 @@ namespace Umbraco.Core.IO
#region Helper Methods
protected string MakeRelativePath(string fullPath)
{
return fullPath.Substring(_rootPath.Length).TrimStart(new char[1]
{
Path.DirectorySeparatorChar
});
}
protected virtual void EnsureDirectory(string path)
{
path = GetFullPath(path);

View File

@@ -21,4 +21,5 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("cms")]
[assembly: InternalsVisibleTo("umbraco")]
[assembly: InternalsVisibleTo("businesslogic")]
[assembly: InternalsVisibleTo("umbraco.editorControls")]
[assembly: InternalsVisibleTo("Umbraco.Tests")]

View File

@@ -51,6 +51,7 @@
<Compile Include="DelegateEqualityComparer.cs" />
<Compile Include="EnumerableExtensions.cs" />
<Compile Include="IfExtensions.cs" />
<Compile Include="IO\AbstractFileSystem.cs" />
<Compile Include="IO\FileSystemProvider.cs" />
<Compile Include="IO\FileSystemProviderManager.cs" />
<Compile Include="IO\IFileSystem.cs" />

View File

@@ -136,6 +136,35 @@ namespace Umbraco.Tests.IO
_fileSystem.DeleteFile("test.txt");
}
[Test]
public void Can_Convert_Full_Path_And_Url_To_Relative_Path()
{
_fileSystem.AddFile("test.txt", CreateStream());
var url = _fileSystem.GetUrl("test.txt");
var fullPath = _fileSystem.GetFullPath("test.txt");
Assert.AreNotEqual("test.txt", url);
Assert.AreNotEqual("test.txt", fullPath);
Assert.AreEqual("test.txt", _fileSystem.GetRelativePath(url));
Assert.AreEqual("test.txt", _fileSystem.GetRelativePath(fullPath));
_fileSystem.DeleteFile("test.txt");
}
[Test]
public void Can_Get_Size()
{
var stream = CreateStream();
var streamLength = stream.Length;
_fileSystem.AddFile("test.txt", stream);
Assert.AreEqual(streamLength, _fileSystem.GetSize("test.txt"));
_fileSystem.DeleteFile("test.txt");
}
#region Helper Methods
protected Stream CreateStream(string contents = null)

View File

@@ -4,6 +4,8 @@ using System.Web.UI;
using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using umbraco.presentation;
using umbraco.cms.businesslogic.web;
using umbraco.cms.businesslogic;

View File

@@ -9,7 +9,10 @@ namespace umbraco.cms.businesslogic.Files
{
string Filename { get; }
string Extension { get; }
[Obsolete("LocalName is obsolete, please use URL instead", false)]
string LocalName { get; }
string Path { get; }
string Url { get; }
bool SupportsResizing { get; }
string GetFriendlyName();
System.Tuple<int, int> GetDimensions();

View File

@@ -6,109 +6,89 @@ using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Web;
using Umbraco.Core.IO;
using Encoder = System.Text.Encoder;
namespace umbraco.cms.businesslogic.Files
{
public class UmbracoFile : IFile
{
private string _fullFilePath;
private string _path;
private string _fileName;
private string _directoryName;
private string _extension;
private string _localName;
private string _url;
private long _length;
private IFileSystem _fs;
#region Constructors
public UmbracoFile()
{
_fs = FileSystemProviderManager.Current.GetFileSystemProvider(FileSystemProvider.Media);
}
public UmbracoFile(string fullFilePath)
public UmbracoFile(string path)
{
_fullFilePath = fullFilePath;
_fs = FileSystemProviderManager.Current.GetFileSystemProvider(FileSystemProvider.Media);
_path = path;
initialize();
}
#endregion
public static UmbracoFile Save(HttpPostedFile file, string fullFileName)
#region Static Methods
//MB: Do we really need all these overloads? looking through the code, only one of them is actually used
public static UmbracoFile Save(HttpPostedFile file, string path)
{
byte[] fileData = null;
using (var binaryReader = new BinaryReader(file.InputStream))
{
fileData = binaryReader.ReadBytes(file.ContentLength);
}
return Save(fileData, fullFileName);
return Save(file.InputStream, path);
}
public static UmbracoFile Save(HttpPostedFileBase file, string fullFileName)
public static UmbracoFile Save(HttpPostedFileBase file, string path)
{
byte[] fileData = null;
using (var binaryReader = new BinaryReader(file.InputStream))
{
fileData = binaryReader.ReadBytes(file.ContentLength);
}
return Save(fileData, fullFileName);
return Save(file.InputStream, path);
}
public static UmbracoFile Save(Stream inputStream, string fullFileName){
byte[] fileData = null;
using (var binaryReader = new BinaryReader(inputStream))
{
fileData = binaryReader.ReadBytes((int)inputStream.Length);
}
public static UmbracoFile Save(Stream inputStream, string path)
{
var fs = FileSystemProviderManager.Current.GetFileSystemProvider(FileSystemProvider.Media);
fs.AddFile(path, inputStream);
return Save(fileData, fullFileName);
return new UmbracoFile(path);
}
public static UmbracoFile Save(byte[] file, string fullFileName)
public static UmbracoFile Save(byte[] file, string relativePath)
{
string fullFilePath = IO.IOHelper.MapPath(fullFileName);
// create directories
DirectoryInfo di = new DirectoryInfo(IO.IOHelper.MapPath(fullFilePath.Substring(0, fullFilePath.LastIndexOf(Path.DirectorySeparatorChar))));
if (!di.Exists)
{
var currentDir = IO.IOHelper.MapPath(IO.SystemDirectories.Root);
var rootDir = IO.IOHelper.MapPath(IO.SystemDirectories.Root);
foreach (var dir in di.FullName.Substring(rootDir.Length).Split(Path.DirectorySeparatorChar))
{
currentDir = Path.Combine(currentDir, dir);
if (!new DirectoryInfo(currentDir).Exists)
{
Directory.CreateDirectory(currentDir);
}
}
}
File.WriteAllBytes(fullFilePath, file);
return new UmbracoFile(fullFilePath);
return Save(new MemoryStream(file), relativePath);
}
public static UmbracoFile Save(HttpPostedFile file)
{
string tempDir = Path.Combine(IO.SystemDirectories.Media, "uploads", Guid.NewGuid().ToString());
return Save(file, tempDir);
}
//filebase overload...
public static UmbracoFile Save(HttpPostedFileBase file)
{
string tempDir = Path.Combine(IO.SystemDirectories.Media, "uploads", Guid.NewGuid().ToString());
string tempDir = System.IO.Path.Combine(IO.SystemDirectories.Media, "uploads", Guid.NewGuid().ToString());
return Save(file, tempDir);
}
//filebase overload...
public static UmbracoFile Save(HttpPostedFileBase file)
{
string tempDir = System.IO.Path.Combine(IO.SystemDirectories.Media, "uploads", Guid.NewGuid().ToString());
return Save(file, tempDir);
}
#endregion
private void initialize()
{
var fi = new FileInfo(_fullFilePath);
_fileName = fi.Name;
_length = fi.Length;
_directoryName = fi.DirectoryName;
_extension = fi.Extension.Substring(1).ToLowerInvariant();
_localName =
"/" + fi.FullName.Substring(IO.IOHelper.MapPath(IO.SystemDirectories.Root).Length).Replace(
Path.DirectorySeparatorChar.ToString(), "/");
_fileName = System.IO.Path.GetFileName(_path);
_length = _fs.GetSize(_path);
_extension = System.IO.Path.GetExtension(_path) != null
? System.IO.Path.GetExtension(_path).Substring(1).ToLowerInvariant()
: "";
_url = _fs.GetUrl(_path);
}
#region IFile Members
@@ -124,9 +104,20 @@ namespace umbraco.cms.businesslogic.Files
get { return _extension; }
}
[Obsolete("LocalName is obsolete, please use Url instead", false)]
public string LocalName
{
get { return _localName; }
get { return Url; }
}
public string Path
{
get { return _path; }
}
public string Url
{
get { return _url; }
}
public long Length
@@ -155,11 +146,8 @@ namespace umbraco.cms.businesslogic.Files
{
throwNotAnImageException();
FileStream fs = new FileStream(_fullFilePath,
FileMode.Open, FileAccess.Read, FileShare.Read);
Image image = Image.FromStream(fs);
var fs = _fs.OpenFile(_path);
var image = Image.FromStream(fs);
var fileWidth = image.Width;
var fileHeight = image.Height;
fs.Close();
@@ -172,42 +160,43 @@ namespace umbraco.cms.businesslogic.Files
{
throwNotAnImageException();
string fileNameThumb = DoResize(width, height, 0, String.Empty);
var fileNameThumb = DoResize(width, height, 0, String.Empty);
return fileNameThumb.Substring(IO.IOHelper.MapPath(IO.SystemDirectories.Root).Length-1);
return _fs.GetUrl(fileNameThumb);
}
public string Resize(int maxWidthHeight, string fileNameAddition)
{
throwNotAnImageException();
string fileNameThumb = DoResize(GetDimensions().Item1, GetDimensions().Item2, maxWidthHeight, fileNameAddition);
var fileNameThumb = DoResize(GetDimensions().Item1, GetDimensions().Item2, maxWidthHeight, fileNameAddition);
return fileNameThumb.Substring(IO.IOHelper.MapPath(IO.SystemDirectories.Root).Length);
return _fs.GetUrl(fileNameThumb);
}
private string DoResize(int width, int height, int maxWidthHeight, string fileNameAddition)
{
FileStream fs = new FileStream(_fullFilePath,
FileMode.Open, FileAccess.Read, FileShare.Read);
Image image = Image.FromStream(fs);
var fs = _fs.OpenFile(_path);
var image = Image.FromStream(fs);
fs.Close();
string fileNameThumb = String.IsNullOrEmpty(fileNameAddition) ?
string.Format("{0}_UMBRACOSYSTHUMBNAIL.jpg", _fullFilePath.Substring(0, _fullFilePath.LastIndexOf("."))) :
string.Format("{0}_{1}.jpg", _fullFilePath.Substring(0, _fullFilePath.LastIndexOf(".")), fileNameAddition);
string.Format("{0}_UMBRACOSYSTHUMBNAIL.jpg", _path.Substring(0, _path.LastIndexOf("."))) :
string.Format("{0}_{1}.jpg", _path.Substring(0, _path.LastIndexOf(".")), fileNameAddition);
fileNameThumb = generateThumbnail(
image,
maxWidthHeight,
width,
height,
_fullFilePath,
_path,
_extension,
fileNameThumb,
maxWidthHeight == 0
).FileName;
image.Dispose();
return fileNameThumb;
}
@@ -269,7 +258,13 @@ namespace umbraco.cms.businesslogic.Files
// Save the new image using the dimensions of the image
string newFileName = thumbnailFileName.Replace("UMBRACOSYSTHUMBNAIL",
string.Format("{0}x{1}", widthTh, heightTh));
bp.Save(newFileName, codec, ep);
var ms = new MemoryStream();
bp.Save(ms, codec, ep);
ms.Seek(0, 0);
_fs.AddFile(newFileName, ms);
ms.Close();
bp.Dispose();
g.Dispose();

View File

@@ -58,7 +58,7 @@ namespace umbraco.cms.businesslogic.datatype
? Path.Combine(PropertyId.ToString(), name)
: PropertyId + "-" + name;
fileName = Path.Combine(SystemDirectories.Media, fileName);
//fileName = Path.Combine(SystemDirectories.Media, fileName);
um = UmbracoFile.Save(fileStream, fileName);
if (um.SupportsResizing)
@@ -111,7 +111,7 @@ namespace umbraco.cms.businesslogic.datatype
}
}
base.Value = um.LocalName;
base.Value = um.Url;
}
else
{

View File

@@ -147,6 +147,10 @@
<Project>{E469A9CE-1BEC-423F-AC44-713CD72457EA}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
</ProjectReference>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj">
<Project>{31785BC3-256C-4613-B2F5-A1B0BDDED8C1}</Project>
<Name>Umbraco.Core</Name>
</ProjectReference>
<ProjectReference Include="..\umbraco.datalayer\umbraco.datalayer.csproj">
<Project>{C7CB79F0-1C97-4B33-BFA7-00731B579AE2}</Project>
<Name>umbraco.datalayer</Name>

View File

@@ -102,6 +102,10 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj">
<Project>{31785bc3-256c-4613-b2f5-a1b0bdded8c1}</Project>
<Name>Umbraco.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Umbraco.Web\Umbraco.Web.csproj">
<Project>{651E1350-91B6-44B7-BD60-7207006D7003}</Project>
<Name>Umbraco.Web</Name>

View File

@@ -4,6 +4,7 @@ using System.Text.RegularExpressions;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Umbraco.Core.IO;
using umbraco.interfaces;
using umbraco.IO;
using Content = umbraco.cms.businesslogic.Content;
@@ -18,8 +19,11 @@ namespace umbraco.editorControls
private readonly String _thumbnails;
private String _text;
private IFileSystem _fs;
public uploadField(IData Data, string ThumbnailSizes)
{
_fs = FileSystemProviderManager.Current.GetFileSystemProvider(FileSystemProvider.Media);
_data = (cms.businesslogic.datatype.DefaultData) Data;
_thumbnails = ThumbnailSizes;
}
@@ -107,8 +111,6 @@ namespace umbraco.editorControls
// we update additional properties post image upload
if (_data.Value != DBNull.Value && !string.IsNullOrEmpty(_data.Value.ToString()))
{
string fullFilePath = IOHelper.MapPath(_data.Value.ToString());
Content content = Content.GetContentFromVersion(_data.Version);
// update extension in UI
@@ -177,27 +179,29 @@ namespace umbraco.editorControls
Text = _data.Value.ToString();
}
private void deleteFile(string file)
private void deleteFile(string fileUrl)
{
if (file.Length > 0)
if (fileUrl.Length > 0)
{
// delete old file
if (File.Exists(IOHelper.MapPath(file)))
File.Delete(IOHelper.MapPath(file));
var relativeFilePath = _fs.GetRelativePath(fileUrl);
string extension = (file.Substring(file.LastIndexOf(".") + 1, file.Length - file.LastIndexOf(".") - 1));
// delete old file
if (_fs.FileExists(relativeFilePath))
_fs.DeleteFile(relativeFilePath);
string extension = (relativeFilePath.Substring(relativeFilePath.LastIndexOf(".") + 1, relativeFilePath.Length - relativeFilePath.LastIndexOf(".") - 1));
extension = extension.ToLower();
//check for thumbnails
if (",jpeg,jpg,gif,bmp,png,tiff,tif,".IndexOf("," + extension + ",") > -1)
{
//delete thumbnails
string thumbnailfile = file.Replace("." + extension, "_thumb");
string relativeThumbFilePath = relativeFilePath.Replace("." + extension, "_thumb");
try
{
if (File.Exists(IOHelper.MapPath(thumbnailfile + _thumbnailext)))
File.Delete(IOHelper.MapPath(thumbnailfile + _thumbnailext));
if (_fs.FileExists(relativeThumbFilePath + _thumbnailext))
_fs.DeleteFile(relativeThumbFilePath + _thumbnailext);
}
catch
{
@@ -210,12 +214,12 @@ namespace umbraco.editorControls
{
if (thumb != "")
{
string thumbnailextra = thumbnailfile + "_" + thumb + _thumbnailext;
string relativeExtraThumbFilePath = relativeThumbFilePath + "_" + thumb + _thumbnailext;
try
{
if (File.Exists(IOHelper.MapPath(thumbnailextra)))
File.Delete(IOHelper.MapPath(thumbnailextra));
if (_fs.FileExists(relativeExtraThumbFilePath))
_fs.DeleteFile(relativeExtraThumbFilePath);
}
catch
{
@@ -269,17 +273,18 @@ namespace umbraco.editorControls
{
if (!string.IsNullOrEmpty(Text))
{
string ext = _text.Substring(_text.LastIndexOf(".") + 1, _text.Length - _text.LastIndexOf(".") - 1);
string fileNameThumb = _text.Replace("." + ext, "_thumb.jpg");
bool hasThumb = false;
var relativeFilePath = _fs.GetRelativePath(_text);
var ext = relativeFilePath.Substring(relativeFilePath.LastIndexOf(".") + 1, relativeFilePath.Length - relativeFilePath.LastIndexOf(".") - 1);
var relativeThumbFilePath = relativeFilePath.Replace("." + ext, "_thumb.jpg");
var hasThumb = false;
try
{
hasThumb = File.Exists(IOHelper.MapPath(IOHelper.FindFile(fileNameThumb)));
hasThumb = _fs.FileExists(relativeThumbFilePath);
// 4.8.0 added support for png thumbnails (but for legacy it might have been jpg - hence the check before)
if (!hasThumb && (ext == "gif" || ext == "png"))
{
fileNameThumb = _text.Replace("." + ext, "_thumb.png");
hasThumb = File.Exists(IOHelper.MapPath(IOHelper.FindFile(fileNameThumb)));
relativeThumbFilePath = relativeFilePath.Replace("." + ext, "_thumb.png");
hasThumb = _fs.FileExists(relativeThumbFilePath);
}
}
catch
@@ -287,17 +292,19 @@ namespace umbraco.editorControls
}
if (hasThumb)
{
var thumb = new Image();
thumb.ImageUrl = fileNameThumb;
thumb.BorderStyle = BorderStyle.None;
var thumb = new Image
{
ImageUrl = _fs.GetUrl(relativeThumbFilePath),
BorderStyle = BorderStyle.None
};
output.WriteLine("<a href=\"" + IOHelper.FindFile(_text) + "\" target=\"_blank\">");
output.WriteLine("<a href=\"" + _fs.GetUrl(relativeFilePath) + "\" target=\"_blank\">");
thumb.RenderControl(output);
output.WriteLine("</a><br/>");
}
else
output.WriteLine("<a href=\"" + IOHelper.FindFile(Text) + "\" target=\"_blank\">" +
IOHelper.FindFile(Text) + "</a><br/>");
output.WriteLine("<a href=\"" + _fs.GetUrl(relativeFilePath) + "\" target=\"_blank\">" +
_fs.GetUrl(relativeFilePath) + "</a><br/>");
output.WriteLine("<input type=\"checkbox\" id=\"" + ClientID + "clear\" name=\"" + ClientID +
"clear\" value=\"1\"/> <label for=\"" + ClientID + "clear\">" + ui.Text("uploadClear") +