Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. Web;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Namespace fileio
{
Public partial class uploadfile: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
}
Protected void button#click (Object sender, eventargs E)
{
String Path = server. mappath ("~ /Upload /");
Httpfilecollection uploadfiles = request. files;
For (INT I = 0; I <uploadfiles. Count; I ++)
{
Httppostedfile userpostedfile = uploadfiles [I];
Try
{
If (userpostedfile. contentlength> 0)
{
Userpostedfile. saveas (path + userpostedfile. filename );
}
}
Catch (exception)
{
Throw;
}
}
}
}
}
{
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ closed_text_224116 '). style. display = 'none'; document. getelementbyid ('Code _ open_image_224116 '). style. display = 'inline'; document. getelementbyid ('Code _ open_text_224116 '). style. display = 'inline ';
}
} "Id =" code_closed_image_224116 "style =" display: none "> {
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ open_text_224116 '). style. display = 'none'; getelementbyid ('Code _ closed_image_224116 '). style. display = 'inline'; getelementbyid ('Code _ closed_text_224116 '). style. display = 'inline ';
}
} "Id =" code_open_image_224116 "> code
<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "uploadfile. aspx. cs" inherits = "fileio. uploadfile" %>
<! 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>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: fileupload id = "fileupload1" runat = "server"/> <br/>
<Asp: fileupload id = "fileupload2" runat = "server"/> <br/>
<Asp: fileupload id = "fileupload3" runat = "server"/> <br/>
<Asp: button id = "button1" runat = "server" onclick = "button#click" text = "Upload"/>
</Div>
</Form>
</Body>
</Html>