/// <summary> Add the file input and the necessary script section, with /// all the options specfiedi here, directly to the streamwriter </summary> /// <param name="Output"> Writer to write to the stream </param> public void Add_To_Stream(TextWriter Output) { // If there is no current HTTPContext, can't do this... if ((UploadPath.Length > 0) && (HttpContext.Current != null)) { // Create a new security token, save in session, and set token GUID in the form data UploadiFive_Security_Token newToken = new UploadiFive_Security_Token(UploadPath, AllowedFileExtensions, FileObjName, ServerSideFileName); FormData["token"] = newToken.ThisGuid.ToString(); HttpContext.Current.Session["#UPLOADIFIVE::" + newToken.ThisGuid.ToString()] = newToken; } // Add the file input element Output.Write("<input id=\"" + FileInputID + "\" name=\"" + FileInputID + "\" "); if (FileInputClass.Length > 0) { Output.Write("class=\"" + FileInputClass + "\" "); } Output.WriteLine("type=\"file\" />"); Output.WriteLine(); // Add the script for this to be added to the ready document event Output.WriteLine("<script type=\"text/javascript\">"); Output.WriteLine(" $(document).ready(function() {"); // Allow the settings object to write the actual jquery settings.Add_To_Stream(Output, String.Empty, String.Empty); Output.WriteLine(" });"); Output.WriteLine("</script>"); Output.WriteLine(); }
/// <summary> Add the file input and the necessary script section, with /// all the options specfiedi here, directly to the streamwriter </summary> /// <param name="Output"> Writer to write to the stream </param> public void Add_To_Stream(TextWriter Output) { // If there is no current HTTPContext, can't do this... if ((UploadPath.Length > 0) && (HttpContext.Current != null)) { // Create a new security token, save in session, and set token GUID in the form data UploadiFive_Security_Token newToken = new UploadiFive_Security_Token(UploadPath, AllowedFileExtensions, FileObjName, ServerSideFileName); FormData["token"] = newToken.ThisGuid.ToString(); HttpContext.Current.Session["#UPLOADIFIVE::" + newToken.ThisGuid.ToString()] = newToken; } // Add the file input element Output.Write("<input id=\"" + FileInputID + "\" name=\"" + FileInputID + "\" "); if (FileInputClass.Length > 0) Output.Write("class=\"" + FileInputClass + "\" "); Output.WriteLine("type=\"file\" />"); Output.WriteLine(); // Add the script for this to be added to the ready document event Output.WriteLine("<script type=\"text/javascript\">"); Output.WriteLine(" $(document).ready(function() {"); // Allow the settings object to write the actual jquery settings.Add_To_Stream(Output, String.Empty, String.Empty); Output.WriteLine(" });"); Output.WriteLine("</script>"); Output.WriteLine(); }