1  /  1  页   1 跳转 查看:697

文件上传

文件上传

刚到这来感觉还不错 把我的东西分享了 不知道这里面有没有?

< html>

< head>

< script language="C#" runat="server">

void Button1_Click(object Source, EventArgs e) {

if (Text1.Value == "") {

Span1.InnerHtml = "Error: you must enter a file name";

return;

}

if (File1.PostedFile != null) {

try {

File1.PostedFile.SaveAs("c:\\temp\\"+Text1.Value);

Span1.InnerHtml = "File uploaded successfully to c:\\temp\\"+Text1.Value+"
on the web server";

}

catch (Exception exc) {

Span1.InnerHtml = "Error saving file c:\\temp\\"+Text1.Value+"

"+ exc.ToString();

}

}

}

< /head>

< body>

HtmlInputFile Sample


Select File to Upload:




Save as filename (no path): < input id="Text1" type="text" runat="server">



< span id=Span1 style="font: 8pt verdana;" runat="server" />



< input type=button id="Button1" value="Upload" 
runat="server">
< /form>
< /body>

< /html>

最后编辑狼鱼 最后编辑于 2008-03-17 14:51:25
 

回复:ASP.NET开发人员手册.pdf

怎么没有东西啊?
http://www.Aspx1.Com
请帮忙宣传Aspx1 , Aspx1是ASP.NET学习者的家园 , 适宜长期居住.
 

回复:文件上传

我想传了 但太大了 我那个20多M
 
1  /  1  页   1 跳转

版权所有 ASP.NET学习门户 2.0.1214   Sitemap  

返顶部