Jsp file upload and browsing, supports ie6, ie7, and ie8

Source: Internet
Author: User

After searching for a long time, I finally found a jsp that can be used ...... Share !!

Copy codeThe Code is as follows: <% @ page language = "java" contentType = "text/html; charset = UTF-8"
PageEncoding = "UTF-8" %>
<% @ Taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<! 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>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Link rel = "stylesheet" href = "../css/common.css" href = "css/common.css" type = "text/css"/>
<Title> Management Area </title>
<Style type = "text/css"> <! --
# NewPreview
{
Filter: progid: DXImageTransform. Microsoft. AlphaImageLoader (sizingMethod = scale );
}
--> </Style>
<Script type = "text/javascript" language = "javascript"> <! --
Var flag = true;
Function PreviewImg (imgFile)
{
// The New preview code, which supports IE6, IE7, and IE8, is not supported by firefox !! I tested ......
Var newPreview = document. getElementById ("newPreview ");
NewPreview. filters. item ("DXImageTransform. Microsoft. AlphaImageLoader"). src = imgFile. value;
If (flag)
{
NewPreview. style. width = "100px ";
NewPreview. style. height = "80px ";
}
}
Function setImgWH ()
{
Var newPreview = document. getElementById ("newPreview ");
Flag = false;
NewPreview. style. width = document. getElementById ("txtImgWidth"). value ;;
NewPreview. style. height = document. getElementById ("txtImgHeight"). value;
}
// --> </Script>
</Head>
<Body>
<Div id = "man_zone">
<Form action = "product. do? Command = addProduct "method =" post "name =" Upload "enctype =" multipart/form-data ">
<Table width = "100%" border = "0" align = "center" cellpadding = "3"
Cellspacing = "1" class = "table_style">

<Tr>
<Td class = "left_title_2">
Product image:
</Td>
<Td> <input type = "file" name = "file" onchange = "javascript: PreviewImg (this);" style = "border: 1px # FFFFFF
Solid; background: # efefef "style =" border: 1px # FFFFFF
Solid; background: # efefef "/> <font color = red> * </font> <div id =" newPreview "> </div> </td>
</Tr>
<Tr>
<Td class = "left_title_1">
<Input type = "submit" name = "Submit" value = "add"/>
</Td>
<Td>
<Input type = "reset" name = "Reset" value = "reset"/>
</Td>
</Tr>
</Table>
</Form>
</Div>
</Body>
</Html>

Related Article

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.