zoukankan      html  css  js  c++  java
  • 文件的下载,上传,和邮件的发送

    1,文件的下载
            使用protected System.Web.UI.WebControls.HyperLink hlDownLoad控件,在它的NavigateUrl属性中设置为要下载文件的路径例如:../download/chm制作教程.rar  ,即可。
            这种方法,对压缩文件很有效,但是当要下载是*.txt,*.aspx等文件时,IE浏览器会自动把这些文件打开,考虑其他方法。
    2
    ,邮件的发送

    3,文件的上传
            使用protected System.Web.UI.HtmlControls.HtmlInputFile attach控件,代码如下:
            string fileName=Guid.NewGuid().ToString()+this.attach.PostedFile.FileName.Substring(this.attach.PostedFile.FileName.LastIndexOf("\\")+1);
       string strPath=Server.MapPath("./")+"load\\"+fileName;
       if(this.attach.PostedFile.ContentLength!=0)
       {
        this.attach.PostedFile.SaveAs(strPath);
        Response.Write("<script>confirm('上传成功');</script>");
        Response.Write("<script>window.location.href='test2.aspx'</script>");
       }
  • 相关阅读:
    XML语法
    C/C++对MySQL操作
    HDU 3966 Aragorn's Story
    SPOJ 375 Query on a tree
    SPOJ 913 Query on a tree II
    SPOJ 6779 Can you answer these queries VII
    URAL 1471 Tree
    SPOJ 2798 Query on a tree again!
    POJ 3237 Tree
    SPOJ 4487 Can you answer these queries VI
  • 原文地址:https://www.cnblogs.com/sutengcn/p/199532.html
Copyright © 2011-2022 走看看