Skip to content

Instantly share code, notes, and snippets.

@islaytitans
Created September 20, 2015 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save islaytitans/dcb97060d225a2a7e04d to your computer and use it in GitHub Desktop.
Save islaytitans/dcb97060d225a2a7e04d to your computer and use it in GitHub Desktop.
Subset of the content of the secureFileUpload a Custom Field Type for Sitecore WFFM
namespace JonathanRobbins.SecureFileUpload.Webforms.Controls
{
[ListAdapter("Items", typeof(ListItemsAdapter))]
[Adapter(typeof(FileUploadAdapter))]
public class SecureFileUpload : ValidateControl, IHasTitle
{
[VisualFieldType(typeof(SelectDirectoryField))]
[VisualProperty("Upload To:", 0)]
[DefaultValue("/sitecore/media library")]
[VisualCategory("Upload")]
public string UploadTo
{
get { return this._uploadDir; }
set { this._uploadDir = value; }
}
[PersistenceMode(PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Browsable(false)]
[VisualCategory("File Types")]
[VisualFieldType(typeof(ListField))]
[TypeConverter(typeof(ListItemCollectionConverter))]
[DefaultValue("%3cquery+t%3d%22root%22+vf%3d%22__ID%22%3e%3cvalue%3e%7b7C75E0B5-3C17-4471-9F81-0490306EC71E%7d%3c%2fvalue%3e%3c%2fquery%3e")]
[Description("Collection of items.")]
[VisualProperty("Items:", 100)]
public ListItemCollection Items
{
get
{
return this._items;
}
set
{
this._items = value;
}
}
[TypeConverter(typeof(ListItemCollectionConverter))]
[VisualFieldType(typeof(MultipleSelectedValueField))]
[VisualCategory("File Types")]
[Browsable(false)]
[VisualProperty("Selected Values:", 450)]
public ListItemCollection SelectedValue
{
get
{
return this._selectedItems;
}
set
{
this._selectedItems = value;
}
}
[VisualFieldType(typeof(EditField))]
[VisualProperty("Max file size limit (MB) :", 5)]
[VisualCategory("Upload")]
public string FileSizeLimit
{
get
{
return this._fileSizeLimit.ToString();
}
set
{
int result;
if (!int.TryParse(value, out result))
result = 5;
this._fileSizeLimit = result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment