也发给我一份吧
[email protected]

解决方案 »

  1.   

    给我email,最大4G的文件,很快
      

  2.   

    MSDN中就有代码:ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpgenref/html/cpconhtmlinputfilecontrol.htm
      

  3.   

    bool checkexist(string path)
    {
    FileInfo fi=new FileInfo(path);
     if(fi.Exists) return true;
     else    return false;


    }

    void onupload(object sender, System.EventArgs e)
    {
    if(this.fileUpload.PostedFile.ContentLength!=0)
    {
    string filepath;
    string filename;
    string [] temp;
    filename=fileUpload.PostedFile.FileName;
    temp=filename.Split( '\\');
    filename=temp[(temp.Length)-1];
    filepath = "c:\\temp\\" + filename;
    if(checkexist(filepath)) 
    {
    this.Label1.Text="duplicate filename exists!";
    return; }
    fileUpload.PostedFile.SaveAs(filepath);
     Label1.Text="thank u!  "+this.tb.Value;

    return;
    }
    Label1.Text="no valid file!";




    }
      

  4.   

    <%@page language="C#" debug="true"%>
    <HTML>
    <HEAD>
    <TITLE>
    </TITLE>
    </HEAD>
    <BODY>
    <script language="C#" runat="Server">
    //Event Handler for the upload button
    void UploadFile(object Sender,EventArgs E)
    {
    if (File1.PostedFile !=null) //Checking for valid file
    {
    // PostedFile.FileName gives the entire path.Use Substring function to rip of the filename.
    string StrFileName = File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.LastIndexOf("\\") + 1) ;
    string StrFileType = File1.PostedFile.ContentType ;
    int IntFileSize =File1.PostedFile.ContentLength;
    //Checking for the file length
    if (IntFileSize <=0)
    Response.Write(" <font color='Red'>Uploading of file " + StrFileName + " failed </font>");
    else
    {
    File1.PostedFile.SaveAs(Server.MapPath(".\\" + StrFileName));
    Response.Write( "<font color='green'>Your file " + StrFileName + " of type " + StrFileType + " and size " + IntFileSize.ToString() + " was uploaded successfully</font>");
    }
    }
    }
    </script>
    <H2 align="center">File uploading in ASP.Net using C# - Demo</H2>
    <!-- Declaration of server side form.Note the enctype attribute of the form has to be set to multipart/form-data -->
    <form id="FrmFileUploadDemo" name="FrmFileUploadDemo"  method="post" enctype="multipart/form-data" runat="server">
    <TABLE align="center" bgcolor="lightyellow">
    <TR>
    <TD>
    Select a file to upload <input type="file" id="File1" name="File1" runat="server">
    </TD>
    <TR>
    <TR>
    <TD align="center">
    <input type=button value="Upload" runat="server" id="CmdUpload" onserverclick="UploadFile" />
    </TD>
    </TR>
    </TABLE>
    </form>
    </BODY>
    </HTML>
      

  5.   

    http://dotnet.aspx.cc/ShowDetail.aspx?id=58EA3515-36F2-4FD9-AC89-EAF49F59816C
      

  6.   

    哈哈,给一份,
    [email protected]
      

  7.   

    html
    <input type="file" runat="server" id="file1">c#
    if (file1.PostedFile.ContentLength > 0)
       file1.PostedFile.SaveAs(filename);
      

  8.   

    //判断是否存在同名文件
    public static bool IsExists(string _FileName)
    {
        bool boolReturn = false;
        FileInfo fi = new FileInfo(_FileName);
        if(fi.Exists)
        {
            boolReturn = true;
        }    return boolReturn;
    }
    using System;
    using System.IO;
    using System.Web;
    using System.Web.UI;
    using GL.ProjectHelper.CommonWay;namespace ProjectHelper.ControlHelper
    {
    /// <summary>
    /// Summary description for GInputFile.
    /// </summary>
    public sealed class InputFile
    {
    #region Property Fields private static HttpPostedFile _PostedFile;
    public static HttpPostedFile PostedFile
    {
    get
    {
    return _PostedFile;
    }
    set
    {
    _PostedFile = value;
    }
    } public static string ContentType
    {
    get
    {
    return PostedFile.ContentType;
    }
    } public static string FileName
    {
    get
    {
    return PostedFile.FileName;
    }
    } public static string SaveName
    {
    get
    {
    return DateTime.Now.ToString("yyyyMMddHHmmss") + GString.GetRandom(6) + Path.GetExtension(FileName);
    }
    } #endregion /// <summary>
    /// 返回存储路径
    /// </summary>
    /// <param name="p">页面对象</param>
    /// <param name="strFileName">文件名</param>
    /// <returns>服务器端存储路径</returns>
    private static string GetSavePath(Page p, string strFolder)
    {
    string strPath = p.Server.MapPath("/" + strFolder); if(!Directory.Exists(strPath))
    {
    Directory.CreateDirectory(strPath);
    } return strPath + "\\" + SaveName;
    } /// <summary>
    /// 保存文件
    /// </summary>
    /// <param name="strFolder">文件夹名称</param>
    /// <returns>保存成功?</returns>
    public static bool SaveAs(Page p, string strFolder)
    {
    bool boolReturn = false;
    if(PostedFile.ContentLength > 0)
    {
    PostedFile.SaveAs(GetSavePath(p, strFolder));
    boolReturn = true;
    } return boolReturn;
    }
    }
    }