请问高手们,把文件上传到服务器的控件或方法有哪些? http://dotnet.aspx.cc/ShowDetail.aspx?id=58EA3515-36F2-4FD9-AC89-EAF49F59816C 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%@ Import Namespace="System.IO" %><html><head><title>文件上传</title><script language="C#" runat="server"> void Upload_Click(object sender,EventArgs E) { if(myFile.PostedFile!=null) { try { string fileDir="c:\\aMao"; //注此处可更改为你想要上传的目录 string fileName=System.IO.Path.GetFileName(myFile.PostedFile.FileName); string filePath=System.IO.Path.Combine(fileDir,fileName); myFile.PostedFile.SaveAs(filePath); } catch(Exception exc) { Response.Write("<br>"+exc.Message); } } } </script></head><body> <form id=form1 enctype="multipart/form-data" runat="Server"> Select a file to upload.<br> <input type="file" ID="myFile" runat="Server"> <input type="button" ID="Upload" value="Upload" OnServerClick="Upload_Click" runat="server"></form> </body></html> http://www.lionsky.net/MyWebsite/downsoft/List.Aspx?id=222 新手急求? GridView_RowUpdating~问题 Repeater控件问题 关于 CuteEditor 去掉样式的问题 求助!为啥我的multiview切换视图只有第一次有效 asp.net问题 如何给textbox中的文本设置垂直对齐,以及右对齐 客户端javascript脚本能否获得用户控件(*.ascx)的属性值? 如何删除及编辑? 100分求动态title【比较难】 怎么能把一个很长的字符串比如说sql语句传到一个新打开的页中? 请问现在的vs.net2003是中文版吗??我现在装的好象是2002
<html>
<head>
<title>文件上传</title>
<script language="C#" runat="server">
void Upload_Click(object sender,EventArgs E)
{
if(myFile.PostedFile!=null)
{
try
{
string fileDir="c:\\aMao"; //注此处可更改为你想要上传的目录
string fileName=System.IO.Path.GetFileName(myFile.PostedFile.FileName);
string filePath=System.IO.Path.Combine(fileDir,fileName);
myFile.PostedFile.SaveAs(filePath);
}
catch(Exception exc)
{
Response.Write("<br>"+exc.Message);
}
}
}
</script>
</head>
<body>
<form id=form1 enctype="multipart/form-data" runat="Server">
Select a file to upload.<br>
<input type="file" ID="myFile" runat="Server">
<input type="button" ID="Upload" value="Upload" OnServerClick="Upload_Click" runat="server">
</form>
</body>
</html>