使aspx页面能接受HTML,asp的页面传送的文件[2]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

uot;NewFile"><br>
         <input type="button" value="Send it to the Server" onclick="SendFile();">
        </form>
       </td>
       <td style="WIDTH: 16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
       <td vAlign="top" width="100%">
        Uploaded File URL:<br>
        <INPUT id="txtUrl" style="WIDTH: 100%" readonly type="text">
       </td>
      </tr>
     </table>
     <br>
     Post URL: <span id="eURL">&nbsp;</span>
    </td>
   </tr>
   <tr>
    <td height="100%">
     <iframe name="UploadWindow" width="100%" height="100%"></iframe>
    </td>
   </tr>
  </table>
 </body>
</html>
upload.aspx的内容:
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Upload.aspx.cs" Inherits="Upload"%>
下面是后台代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.IO;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Collections.Specialized;
public partial class Upload : System.Web.UI.Page
{
 public void SendResults(int errorNumber, string fileUrl, string fileName, string customMsg)
 {
  StringBuilder text = new StringBuilder();
  text.Append("<script type=\"text/javascript\">");
  text.Append("window.parent.OnUploadCompleted(" + errorNumber + ",\"" + fileUrl.Replace("\"", "\\\"") + "\",\"" + fileName.Replace("\"", "\\\"") + "\",\"" + customMsg.Replace("\"", "\\\"") + "\") ;\n");
  text.Append(" </script>");
  Response.Write(text.ToString());
  Response.End();
 }
 public void GetConfig(string type, out string[] allowedExt, out string[] denyedExt,out string savePath,out long maxSize)
 {
   XmlDocument doc = new XmlDocument();
   doc.Load(Server.MapPath(@".\Config.xml"));
   XmlElement root=doc.DocumentElement;
   XmlNodeList imageNodelist=root.GetElementsByTagName(type);
   allowedExt = imageNodelist[0].FirstChild.InnerText.Trim().Split('|');
   denyedExt = imageNodelist[0].LastChild.InnerText.Trim().Split('|');
   savePath = root.GetElementsByTagName("userPath").Item(0).InnerText.Trim();
   try
   {
    maxSize = Convert.ToInt64(root.GetElementsByTagName("maxSize").Item(0).InnerText.Trim());
   }
   catch { maxSize = 10*1024; }
 }
 protected void Page_Load(object sender, EventArgs e)
 {

本文关键:使aspx页面能接受HTML,asp的页面传送的文件
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top