C# 上传附件 --类似CSDN一样
效果:
http://u.download.csdn.net/upload  →选择文件上传 我需要点击button 弹出浏览窗口 而不是用<input id="txt_userfile" name="txt_userfile" type="file">这种标签!
 大虾们帮帮忙   急用!!!!

解决方案 »

  1.   

     <style>
    .MultiFile-applied {
        cursor: pointer;
        outline: medium none;
        vertical-align: middle;
        position:absolute;
        top:0;
        left:0;
        width:50px;
        height:50px;
        z-index:99;
            filter:alpha(opacity=0);   
          -moz-opacity:0;   
          -khtml-opacity: 0;   
          opacity: 0;
    }
    .MultiFile-wrap {
        /*background: url("/sysImages/work/upload.gif") no-repeat scroll 0 0 transparent;*/
        display: block;
        outline: medium none;
        position:relative;
        cursor:pointer;
    }
    </style>       
    <a id="uploads_wrap" class="MultiFile-wrap">
                    <img src="/sysImages/work/upload.gif" width="30" height="30" />
                    <iframe src="flow_upload.aspx?no-cache=<%= DateTime.Now.ToString() %>" class="MultiFile-applied" scrolling="no" frameborder="0"></iframe>
                  </a>
                  导入flow_upload.aspx
    <%@ Page Language="C#" EnableEventValidation="false" AutoEventWireup="true" CodeBehind="flow_upload.aspx.cs" Inherits="Galsun.HH.FCX.Web.manage.flow.flow_upload" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style>
        body
        {
            padding:0px; margin:0px;
         }
    .MultiFile-applied {
        cursor: pointer;
        font-size: 40px;
        margin-left: -450px;
    }
        </style>
    </head>
    <script src="/Scripts/jquery-1.4.1.js"></script>
    <body>
        <script>
            function StarImport(num) {
                parent.Import(num);
            }
            function showError(error) {
                parent.showError(error);
            }
        </script>
        <form id="form1" runat="server">
        <div style="width:50px; height:50px; overflow:hidden;">
        <asp:FileUpload ID="FileUpload1" runat="server" CssClass="MultiFile-applied" />
        </div>
        <div style="display:none"><asp:LinkButton ID="bnt_upload" runat="server" onclick="bnt_upload_Click">LinkButton</asp:LinkButton></div>
        </form>
        <script>
            document.getElementById("FileUpload1").onchange = function () {
                if (this.value != "") {
                    parent.UpdateFileing();
                    __doPostBack('bnt_upload', 'Click');
                }
            }
        </script>
    </body>
    </html>
      

  2.   

    大意就是拖一个FileUpload ,然后用css把他放大,就是设置他的字体大小font-size: 40px;
    然后再把透明度设为0,让他浮动到图片之上
      

  3.   

    不行?样式写对了应该就可以,CSDN原版的css样式,只是CSDN直接用file,我这里是用iframe 
      

  4.   

    搜索下file的样式就好了! 有这样的!