Exemplo n.º 1
0
        /// <summary>
        /// Creates HTML for multiple file upload.
        /// </summary>
        /// <param name="name">The value assigned to the name attribute of the file upload input elements.</param>
        /// <param name="initialNumberOfFiles">Initial number of file upload fields to display.</param>
        /// <param name="allowMoreFilesToBeAdded">If true, allows more file upload fields to be added.</param>
        /// <param name="includeFormTag">If true, result includes form tag around all file input tags and submit button. 
        /// If false, user needs to specify their own form tag around call to GetHtml with their own submit button.</param>
        /// <param name="addText">Text to display on a link that allows more file upload fields can be added.</param>
        /// <param name="uploadText">Text to display on the submit button.</param>
        public static HtmlString GetHtml(
            string name = null,
            int initialNumberOfFiles = 1,
            bool allowMoreFilesToBeAdded = true,
            bool includeFormTag = true,
            string addText = null,
            string uploadText = null) {

            HttpContextBase httpContext = new HttpContextWrapper(HttpContext.Current);
            FileUploadImplementation fileUpload = new FileUploadImplementation(httpContext);
            return fileUpload.GetHtml(name: name, initialNumberOfFiles: initialNumberOfFiles, allowMoreFilesToBeAdded: allowMoreFilesToBeAdded, includeFormTag: includeFormTag,
                addText: addText, uploadText: uploadText);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates HTML for multiple file upload.
        /// </summary>
        /// <param name="name">The value assigned to the name attribute of the file upload input elements.</param>
        /// <param name="initialNumberOfFiles">Initial number of file upload fields to display.</param>
        /// <param name="allowMoreFilesToBeAdded">If true, allows more file upload fields to be added.</param>
        /// <param name="includeFormTag">If true, result includes form tag around all file input tags and submit button.
        /// If false, user needs to specify their own form tag around call to GetHtml with their own submit button.</param>
        /// <param name="addText">Text to display on a link that allows more file upload fields can be added.</param>
        /// <param name="uploadText">Text to display on the submit button.</param>
        public static HtmlString GetHtml(
            string name = null,
            int initialNumberOfFiles     = 1,
            bool allowMoreFilesToBeAdded = true,
            bool includeFormTag          = true,
            string addText    = null,
            string uploadText = null)
        {
            HttpContextBase          httpContext = new HttpContextWrapper(HttpContext.Current);
            FileUploadImplementation fileUpload  = new FileUploadImplementation(httpContext);

            return(fileUpload.GetHtml(name: name, initialNumberOfFiles: initialNumberOfFiles, allowMoreFilesToBeAdded: allowMoreFilesToBeAdded, includeFormTag: includeFormTag,
                                      addText: addText, uploadText: uploadText));
        }