?? up2.asp
字號:
<!--#include file="../Session.asp"-->
<link href="../../css/site.css" rel="stylesheet" type="text/css">
<%
'---------------------------要改的地方(由此文件的路徑決定)----------------
'2行(樣式文件),10行form.對象名稱.value(注意大小寫),15行(臨時文件),28行(上傳路徑)
'33行(年月文件夾路徑),70行(cab文件),71行(asp文件),72行(上傳文件大小),74行(充許的文件格式)
'----------------------------------------------------------------
if Request("Up")="Yes" and Request.Form("UpFile")<>"" then
'寫入文本框
Response.write "<script>parent.form.Pic2.value='"&Split(Request.Form("UpFile"),"/./")(1)&"'</script>"
'成功提示
Response.Write("<table border=0 cellpadding=0 cellspacing=0 bgcolor=#BBD2D1 width='100%' height='30'><tr><td align=center> 上傳成功 <input name=Submit type=button class=button onclick=javascript:window.history.go(-1) value=重新上傳></td></tr></table>")
'刪除臨時文件
Dim TempFile_Del
MDBTempFile="../../Up.tmp" ' 請與YzShopCartFso.asp中的文件名保持一至
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
TempFile_Del=server.mappath(MDBTempFile)
If FSO.FileExists(TempFile_Del) Then
FSO.DeleteFile (TempFile_Del),true
end if
Set FSO = nothing
'失敗提示
elseif Request("Up")="Yes" and Request.Form("UpFile")="" then
Response.Write("<table border=0 cellpadding=0 cellspacing=0 bgcolor=#BBD2D1 width='100%' height='30'><tr><td align=center> <font color=#FF6600>上傳失敗</font> <input name=Submit type=button class=button onclick=javascript:window.history.go(-1) value=重新上傳></td></tr></table>")
else
Dim UpFile
'文件上傳路徑,系統自動加上"年月"文件夾
UpFile="Pic/FirstPic/"
'以“年月”創建上傳文件夾
'Dim objFSO,Fsofolder,YearMonth
'YearMonth=year(date)&right("00"&month(date),2)
'Set objFSO = Server.createObject("Scripting.FileSystemObject")
'FilePath=Server.MapPath("../../"&UpFile&YearMonth)
'If objFSO.FolderExists (FilePath)=False Then
' objFSO.createFolder (FilePath)
'End If'If err.number = 0 then:成功
'UpFile=UpFile&YearMonth
'Set objFSO = Nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>YzShopCartUp</title>
<script language="javascript">
function selfile(oUpload,oText) // 選擇一個文件
{
oText.innerText = oUpload.selectfile(); // 顯示用戶選擇文件
}
function selfiles(oUpload,oText) // 選擇多個文件
{
var re = /\+/g; // 匹配模式,多個文件名之間使用加號(+)分割
oText.innerText = oUpload.selectfiles().replace(re,"\n"); // 顯示用戶選擇文件
}
function check_reply(oForm)
{
oForm.UpFile.innerText = UpLoadid.uploadfile(); // 獲得遠程文件地址
}
</script>
</head>
<body leftmargin="0" topmargin="0" onload="clearfile();">
<object id="UpLoadid" classid="clsid:18B9E4BF-F21F-46B9-AD50-5CA62145426A" height="0" width="0" codebase="../../Up.cab#Version=3,0,0,0">
<param name="Action" value="../../Up.asp">
<param name="MaxFileSize" value="51200">
<param name="SubPath" value="<%=UpFile%>">
<param name="AllowExt" value="png;gif;jpg">
</object>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form method="post" action="?Up=Yes" onsubmit="return check_reply(this);">
<tr>
<td bgcolor="#BBD2D1">
<input name="UpFile" type="text" value="" size="25" readonly="readonly" class="input1">
<input type="button" class=button value="選擇圖片" onclick="selfile(UpLoadid,UpFile);">
<input type="submit" name="submit" class=button value="上 傳"> <input type="reset" name="submit" class=button value="重 置" onclick="UpLoadid.reset();">
</td>
</tr>
</form>
</table>
</body>
</html>
<%end if%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -