首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

ASP修改幻灯片图片时如何删除原图

2012-06-21 
ASP修改幻灯片图片时怎么删除原图这是原代码 望哪位大大能指点一二 怎么在修改幻灯片图片时能同时删除原图

ASP修改幻灯片图片时怎么删除原图
这是原代码 望哪位大大能指点一二 怎么在修改幻灯片图片时能同时删除原图 用的是upload上传文件
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/conn.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("hid") <> "") Then 
  Recordset1__MMColParam = Request.QueryString("hid")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM dbo.Hpic_biao WHERE hid = " + Replace(Recordset1__MMColParam, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last

' set the record count
Recordset1_total = Recordset1.RecordCount

' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
  Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
  Recordset1_numRows = 1
End If

' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1

' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
  If (Recordset1_first > Recordset1_total) Then
  Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
  Recordset1_last = Recordset1_total
  End If
  If (Recordset1_numRows > Recordset1_total) Then
  Recordset1_numRows = Recordset1_total
  End If
End If
%>

<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (Recordset1_total = -1) Then

  ' count the total records by iterating through the recordset
  Recordset1_total=0
  While (Not Recordset1.EOF)
  Recordset1_total = Recordset1_total + 1
  Recordset1.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (Recordset1.CursorType > 0) Then
  Recordset1.MoveFirst
  Else
  Recordset1.Requery
  End If

  ' set the number of rows displayed on this page
  If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
  Recordset1_numRows = Recordset1_total
  End If

  ' set the first and last displayed record
  Recordset1_first = 1
  Recordset1_last = Recordset1_first + Recordset1_numRows - 1
  
  If (Recordset1_first > Recordset1_total) Then
  Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
  Recordset1_last = Recordset1_total
  End If

End If
%>

<!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=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
background-image: url(images/htgl_03.png);
background-repeat: no-repeat;
}
a:link {
color: #000000;
text-decoration: none;


}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.STYLE2 {
font-size: 24px;
font-family: "黑体";
}
.STYLE3 {font-size: 12px}
.STYLE5 {font-family: "宋体"}
.STYLE6 {
font-family: "宋体";
color: #FF0000;
}
-->
</style></head>

<body>
<p class="STYLE2">幻灯片管理</p>
<p class="STYLE2 STYLE3 STYLE5">幻灯片列表</p>
<form action="upload.asp" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <table width="593" height="148" border="1" cellpadding="0" cellspacing="0">
  <tr>
  <td width="100" height="30"><div align="right">名称</div></td>
  <td width="487"><input name="mc" type="text" id="mc" value="<%=(Recordset1.Fields.Item("hmc").Value)%>" /></td>
  </tr>
  <tr>
  <td height="34"><div align="right">URL</div></td>
  <td><input name="url" type="text" id="url" value="<%=(Recordset1.Fields.Item("hurl").Value)%>" /></td>
  </tr>
  <tr>
  <td><div align="right">图片上传</div></td>
  <td><p>
  <input name="pic" type="file" id="pic" value="<%=(Recordset1.Fields.Item("hpic").Value)%>" />
  <img name="" src="<%=(Recordset1.Fields.Item("hpic").Value)%>" alt="" /></p>
  <p class="STYLE6">(*图片为180x123)</p></td>
  </tr>
  <tr>
  <td height="34">&nbsp;</td>
  <td><label>
  <input type="submit" name="Submit" value="提交" />
  </label></td>
  </tr>
  </table>
  <input name="hid" type="hidden" id="hid" value="<%=(Recordset1.Fields.Item("hid").Value)%>" />
</form>
<p class="STYLE2 STYLE3 STYLE5">&nbsp;</p>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>


[解决办法]
ASP文件操作大全 http://blog.vsharing.com/shanlang/A885756.html

热点排行