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>