asp.net 上傳

摘要:asp.net 上傳

 

 
    <asp:FileUpload ID="FileUpload1" runat="server" />
  <p>
        <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="確定" />
 
 
cs
 
 protected void Button2_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            string filename = Path.GetFileName(FileUpload1.FileName);
            FileUpload1.SaveAs("C:\\Users\\NPC00021\\Documents\\Visual Studio 2010\\WebSites\\WebSite1\\images\\" + filename);
 
        }
    }