<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Image_upload.aspx.cs" Inherits="admin_Image_upload" %>

<!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>
    <link href="/images/css/inbox.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
function preview()
{ 
    var file=document.getElementById("imgupload");//获取上传控件

    document.getElementById("imglook").src=file.value;
}
function ReturnImg()
{
    var path=document.getElementById("imgpath").value;
    window.opener.SetUrl(path);
    this.close();
}
function ReturnNull()
{
    var path=document.getElementById("imgupload").value;
    if(path=="")
    {
        alert("请选择上传的图片!");
        return false;
    }
    else
    {
        return true;
    }
}

</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table style="width: 100%" class=Ibx_gTable_Con>
            <tr>
                <td align="center">
                    图片上传...</td>
            </tr>
            <tr>
                <td>
                    <table style="width: 100%">
                        <tr>
                            <td>
                                <asp:FileUpload ID="imgupload" runat="server" onchange="preview()" Width="360px" />&nbsp;<asp:Button
                                    ID="upload" runat="server" Text="上 传" OnClientClick="return ReturnNull()" OnClick="upload_Click" /><input id="btsave" type="button" onclick="ReturnImg()" value="插入图片" /></td>
                          
                        </tr>
                        <tr>
                            <td>
                           <img src="" id=imglook runat=server />
                           <input type=hidden id="imgpath" runat=server />
                                </td>
                           
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
