protected virtual void ProcessMultiRequestUploadRequest(HttpContext context, UploadState uploadState) { string controlID = context.Request.QueryString[MultiRequestUploadModule.ControlIDQueryParam]; if (log.IsDebugEnabled) { log.DebugFormat("controlID={0}", controlID); } string postBackID = context.Request.QueryString[UploadModule.PostBackIDQueryParam]; if (log.IsDebugEnabled) { log.DebugFormat("postBackID={0}", postBackID); } string secureStorageConfigString = context.Request.Form[UploadModule.ConfigFieldNamePrefix + controlID]; if (log.IsDebugEnabled) { log.DebugFormat("secureStorageConfigString={0}", secureStorageConfigString); } string fileSizesString = context.Request.Form[MultiRequestUploadModule.FileSizesFieldName]; if (log.IsDebugEnabled) { log.DebugFormat("fileSizesString={0}", fileSizesString); } context.Response.Clear(); if (postBackID != null && fileSizesString != null && fileSizesString.Length > 0) { string[] fileSizeStrings = fileSizesString.Split(' '); long totalSize = 0; for (int i = 0; i < fileSizeStrings.Length; i++) { long size = Int64.Parse(fileSizeStrings[i]); // fileSizesString contains a -1 for each non-Flash upload // associated with the request. Ignore those so that the // totalSize is not off by one. if (size > 0) { totalSize += size; } } uploadState.IsMultiRequest = true; uploadState.MultiRequestObject = secureStorageConfigString; uploadState.BytesTotal = totalSize; context.Response.Write(String.Format(@"{{ ""ArmoredCookies"" : ""{0}"" }}", MultiRequestUploadModule.GetArmoredCookies())); } // MacOSX Flash player won't fire FileReference.onComplete unless something is returned. context.Response.Write(" "); context.Response.End(); }
protected override void Render(HtmlTextWriter writer) { string targetDivID = "NeatUploadDiv_" + this.ClientID; string name; string storageConfigName = null; if (!IsDesignTime) { storageConfigName = FormContext.Current.GenerateStorageConfigID(this.UniqueID); } if (!IsDesignTime && UploadModule.IsEnabled) { // Generate a special name recognized by the UploadHttpModule name = FormContext.Current.GenerateFileID(this.UniqueID); this.Page.RegisterStartupScript("NeatUploadMultiFile-" + this.UniqueID, @" <script type='text/javascript' language='javascript'> <!-- NeatUploadMultiFileCreate('" + this.ClientID + @"', '" + FormContext.Current.PostBackID + @"', '" + UploadModule.AppPath + @"', '" + (MultiRequestUploadModule.IsEnabled ? (HttpContext.Current.Response.ApplyAppPathModifier(MultiRequestUploadModule.UploadPath)) : "") + @"', '" + UploadModule.PostBackIDQueryParam + @"', {" + UploadModule.PostBackIDQueryParam + @" : '" + FormContext.Current.PostBackID + @"', " + (MultiRequestUploadModule.IsEnabled ? MultiRequestUploadModule.ControlIDQueryParam : "ignore") + @": '" + this.UniqueID + @"', " + (MultiRequestUploadModule.IsEnabled ? MultiRequestUploadModule.ArmoredCookiesQueryParam : "ignore2") + @": '" + MultiRequestUploadModule.GetArmoredCookies() + @"' }, " + (MultiRequestUploadModule.IsEnabled && UseFlashIfAvailable ? "true" : "false") + @", '" + FileQueueControlID + @"', '" + FlashFilterExtensions + @"', '" + FlashFilterDescription + @"', '" + targetDivID + @"', '" + storageConfigName + @"' ); // --> </script>"); } else { name = this.UniqueID; } // Store the StorageConfig in a hidden form field with a related name if (StorageConfig != null && StorageConfig.Count > 0) { writer.AddAttribute(HtmlTextWriterAttribute.Type, "hidden"); writer.AddAttribute(HtmlTextWriterAttribute.Name, storageConfigName); writer.AddAttribute(HtmlTextWriterAttribute.Value, StorageConfig.Protect()); writer.RenderBeginTag(HtmlTextWriterTag.Input); writer.RenderEndTag(); } writer.RenderBeginTag(HtmlTextWriterTag.Div); if (!IsDesignTime) { base.AddAttributesToRender(writer); writer.AddAttribute(HtmlTextWriterAttribute.Type, "file"); writer.AddAttribute(HtmlTextWriterAttribute.Name, name); writer.RenderBeginTag(HtmlTextWriterTag.Input); writer.RenderEndTag(); // input type="file" } if (UploadModule.IsEnabled) { writer.Write("<div id='{0}' style='position: relative; display: {1};'>", targetDivID, IsDesignTime ? "block" : "none"); if (!IsEmpty()) { RenderChildren(writer); } else { writer.AddAttribute(HtmlTextWriterAttribute.Type, "button"); writer.AddAttribute(HtmlTextWriterAttribute.Value, "Pick Files..."); if (!Enabled) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled"); } writer.RenderBeginTag(HtmlTextWriterTag.Input); writer.RenderEndTag(); } writer.Write("</div>"); // The constant strings below are broken apart so that you couldn't just search for the text and // remove it. To find this code, you probably had to understand enough about custom web controls // to know where to look. People who can't find this code are generally less experienced, harder // to support, and less likely to submit patches. So they contribute in another way when they // use NeatUpload - they contribute by advertising it. If they don't want to do that, they can // always have someone more capable find and remove the code for them (probably for a fee). // For more information, see the "Branding, Licensing, and the Trademark" section in // docs/Manual.html. //commented out 2010-05-30 by Joe Audette with Dean's permission since he is no longer maintaining the project //writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "smal" + "ler"); //writer.RenderBeginTag(HtmlTextWriterTag.Span); //writer.Write(" (Po" + "wer" +"ed&nb" + "sp;by&nb" + "sp;"); //writer.AddAttribute(HtmlTextWriterAttribute.Target, "_bla" + "nk"); //writer.AddAttribute(HtmlTextWriterAttribute.Href, // "htt" +"p://ww" + "w.bre"+ "ttle." + "com/" + "neat" + "upload"); //writer.RenderBeginTag(HtmlTextWriterTag.A); //writer.Write("Neat" + "Upload"); //writer.RenderEndTag(); // a //writer.Write(")"); //writer.RenderEndTag(); // span } writer.RenderEndTag(); // div }