📄 picadd.aspx
字号:
<% @ Import Namespace="System.IO" %>
<% @ Import Namespace="System.Data" %>
<% @ Import Namespace="Packaging" %>
<% @ Register TagPrefix="pb" TagName="Header" Src="header.ascx" %>
<% @ Register TagPrefix="pb" TagName="Footer" Src="footer.ascx" %>
<% @ Register TagPrefix="pb" TagName="Login" Src="login.ascx" %>
<% @ Register TagPrefix="pb" TagName="Major" Src="major.ascx" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<title>作品展示上传</title>
<link rel="stylesheet" href="pack.css" type="text/css">
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>
<body topmargin="6" leftmargin="0" bgcolor="#eaea">
<form enctype="multipart/form-data" method="post" runat=server>
<pb:Header id="Header" runat="server" />
<div align="center">
<table border="0" cellpadding="0" cellspacing="1" bgColor="#006699" width="750" height="125">
<tr><td width="25%" valign="top" background="images/bd.gif" rowspan="2" height="125"><pb:login id="login" runat="server" />
<pb:Major id="major" runat="server" /></td>
<td width="75%" valign="top" bgcolor="#FFFFFF" height="228" background="images/ldb.gif">
<br>
<table border="0" cellpadding="0" cellspacing="1" width="90%" bgcolor="#006699">
<tr height=25 bgcolor="#99CC00">
<td colspan="2"><font color=yellow>作品展示上传</font> </td>
</tr>
<tr>
<td bgcolor="#99CC33" align="center">作品名</td>
<td bgcolor="#CCFF99"><asp:TextBox id="title" runat="server" size="20" maxlength="50" />
<asp:RequiredFieldValidator id="rfv" runat="server" Display="Dynamic"
controlToValidate="title" errorMessage="*" /> </td>
</tr>
<tr>
<td bgcolor="#99CC33">选择上传图片:</td>
<td bgcolor="#CCFF99">
<input type=file id=FileUp size=15 runat=server/></td></tr>
<tr>
<td bgcolor="#99CC33">作品说明:</td>
<td bgcolor="#CCFF99"> <asp:TextBox textMode="MultiLine" runat="server" id="desc"
Cols="40" Rows="4" /> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" align="right"> <asp:Label id="success" runat=server style="color:red" /><asp:Button id="Submit" text="上传" onclick="Submit_OnClick" runat=server/>
</td>
</tr>
<tr bgcolor="#CCFF99">
<td width="100%" colspan="2"><br>
注意:
<ul>
<li>可上传文件类型:jpg、gif、png。</li>
<li>由于网速的问题,我们建议你上传的图片大小不要超过200K。</li></ul>
<br>
<input type=hidden name="sid" id="sid" runat="server">
<asp:Panel id="fileinfo" runat=server Visible=False>
文件引用地址:<asp:label id=FName runat=server /><br>
文件大小:<asp:label id=FSize runat=server /><br>
文件类型:<asp:label id=FType runat=server />
</asp:Panel>
</td></tr>
</table>
</td>
<tr><td width="75%" valign="bottom" bgcolor="#FFFFFF" height="80" align="right" background="images/ldb.gif">
<img border="0" src="images/pen.gif" width="400" height="80"><br> </td></tr>
</table>
</div>
<pb:Footer id="footer" runat="server" />
</form>
</body>
</html>
<script language="VB" runat="SERVER">
Dim id As Integer
Sub Page_Load(Sender As Object, e As EventArgs)
If Not Request.IsAuthenticated Then
Response.Redirect("login.aspx")
End If
Dim MyInfo As InfoDB=New InfoDB()
If MyInfo.GetMyId(Context.User.Identity.Name)=0 Then
Response.Redirect("admin.aspx")
End If
If Not Page.IsPostBack Then
Dim MyPic As PicDB=New PicDB()
id=MyPic.Getlast()
sid.value=id.ToString()
Else
id=sid.value
End If
End Sub
Sub Submit_OnClick(Sender As Object, e As EventArgs)
If FileUp.PostedFile.ContentLength=0 Then
FileInfo.Visible=False
success.Text="上传文件长度为0, 上传失败!"
Exit Sub
Else
FSize.Text=CStr(FileUp.PostedFile.Contentlength)
FType.Text=FileUp.PostedFile.ContentType
Dim fileSplit() As String=Split(FileUp.PostedFile.filename, "\")
Dim f As String
If FileUp.PostedFile.ContentType="image/pjpeg" Then
f=Server.MapPath("upload\pic\") + "pic" & id & ".jpg"
FName.Text="upload/pic/pic" & id & ".jpg"
ElseIf FileUp.PostedFile.ContentType="image/gif" Then
f=Server.MapPath("upload\pic\") + "pic" & id & ".gif"
FName.Text="upload/pic/pic" & id & ".gif"
Else
f=Server.MapPath("upload\pic\") + "pic" & id & ".png"
FName.Text="upload/pic/pic" & id & ".png"
End If
fileUp.PostedFile.SaveAs(f)
FileInfo.Visible=True
Dim MyPic As Pic=New Pic()
MyPic.PicTitle=title.Text
MyPic.PicUrl=fname.text
MyPic.PicDesc=desc.text
MyPic.PicTime=DateTime.Now()
MyPic.PicOwner=Context.User.Identity.Name
MyPic.PicClicks=0
Dim MyDB As PicDB=New PicDB()
MyDB.AddPic(MyPic)
success.Text="上传成功!"
End If
End Sub
</script>
<style>
td {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 10pt;
}
.whiteB {
color: white;
font-weight : bold;
}
input {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 10pt;
}
td.bar {
color: green; font-weight: bold;
}
a.whiteLink:link {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-weight : bold;
color : white;
text-decoration : none;
}
a.whiteLink:visited {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-weight : bold;
color : white;
text-decoration : none;
}
a.whiteLink:hover {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-weight : bold;
color : white;
text-decoration : none;
}
a.barLink:link {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : #CCFF99;
text-decoration : none;
}
a.barLink:visited {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : #CCFF99;
text-decoration : none;
}
a.barLink:hover {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : #CCFF99;
text-decoration : underline;
}
a.author:link {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : black;
text-decoration : none;
}
a.author:visited {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : black;
text-decoration : none;
}
a.author:hover {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : black;
text-decoration : underline;
}
</style>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -