Question: How can I change the Browse button of the uploaded file to another style or image?

Source: Internet
Author: User
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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.