In my previous article, I wrote how to replace the "Browse" button. Code
Some friends pointed out that the form could not be submitted,
Because I was just testing whether it could be replaced or browsed.
After a test, the prompt "..." cannot be submitted. Permission .."
Modified as follows:
<% @ Page Language = " C # " Responseencoding = " Gb2312 " Debug = " True " %>
<% @ Import namespace = " System " %>
<% @ Import namespace = " System. Io " %>
<! 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 " XML: Lang = " Gb2312 " Lang = " Gb2312 " >
< Head >
< Title > When uploading < Input type = " File " > Use images instead of browsing buttons </ Title >
< Meta HTTP - Equiv = " Content-Type " Content = " Text/html; charset = gb2312 " />
< Meta name = " Title " Content = "" />
< Meta name = " Author " Content = " Active Target, huobazi " />
< Meta name = " Subject " Content = "" />
< Meta name = " Language " Content = " Gb2312 " />
< Meta name = " Keywords " Content = "" />
< Meta name = " Copyright " Content = "" />
< Meta name = " Robots " Content = " All " />
< Script Language = " C # " Runat = " Server " >
Void Button_click ( Object O, eventargs E)
{
StringStr=Browse. postedfile. contentlength. tostring ();
Response. Write (STR );
}
Void Page_load ( Object O, eventargs E)
{
}
</ Script >
< Script Language = " Javascript " Type = " Text/JavaScript " >
Function fn_browse ()
{
Document. All. Browse. Click ();
Document. All. file. Value=Document. All. Browse. value;
}
Function fn_submit ()
{
Document. Forms [0]. Browse. Disabled= True;
}
</ Script >
</ Head >
< Body >
< Form runat = " Server " Method = " Post " Enctype = " Multipart/form-Data " >
< Input type = " File " ID = " Browse " Runat = " Server " Style = " Display: None " />
< Input type = " Text " Name = " File " />
< A href = " # " Onclick = " Fn_browse () " >
< IMG name = " BTN " SRC = " Browse.gif " Border = " 0 " /> </ A >
< BR />
< BR />
< Input ID = " Button " Type = " Submit " Value = " Submit " Onserverclick = " Button_click " Runat = " Server "
Onclick = " Fn_submit " />
</ Form >
</ Body >
</ Html >
This form can be submitted, but you still cannot upload the selected file. Is there any other way?