HtmlInputFile.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* System.Web.UI.HtmlControls
  2. * Authors
  3. * Leen Toelen ([email protected])
  4. */
  5. using System;
  6. using System.Web;
  7. using System.Web.UI;
  8. using System.Globalization;
  9. using System.Collections.Specialized;
  10. namespace System.Web.UI.HtmlControls{
  11. public class HtmlInputFile : HtmlInputControl, IPostBackDataHandler{
  12. public HtmlInputFile():base("file"){}
  13. public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection){
  14. string postValue = postCollection[postDataKey];
  15. if (postValue != null)
  16. Value = postValue;
  17. return false;
  18. }
  19. public virtual void RaisePostDataChangedEvent(){}
  20. public string Accept{
  21. get{
  22. string attr = Attributes["accept"];
  23. if (attr != null)
  24. return attr;
  25. return String.Empty;
  26. }
  27. set{
  28. Attributes["accept"] = AttributeToString(value);
  29. }
  30. }
  31. public int MaxLength{
  32. get{
  33. string attr = Attributes["maxlength"];
  34. if (attr != null)
  35. return Int32.Parse(attr, CultureInfo.InvariantCulture);
  36. return -1;
  37. }
  38. set{
  39. Attributes["accept"] = AttributeToString(value);
  40. }
  41. }
  42. public int Size{
  43. get{
  44. string attr = Attributes["size"];
  45. if (attr != null)
  46. return Int32.Parse(attr, CultureInfo.InvariantCulture);
  47. return -1;
  48. }
  49. set{
  50. Attributes["size"] = AttributeToString(value);
  51. }
  52. }
  53. public HttpPostedFile PostedFile{
  54. get{
  55. return Context.Request.Files[RenderedName];
  56. }
  57. }
  58. } // class HtmlInputFile
  59. } // namespace System.Web.UI.HtmlControls