 |
|
ช่วยแก้ให้หน่อยค่ะ ด่วนค่ะ Wrong selection : Either BOF or EOF is True, or the current record has be |
|
 |
|
|
 |
 |
|
ขอดูโค้ดด้วยครับ

|
 |
 |
 |
 |
Date :
1 พ.ค. 2550 01:05:08 |
By :
lozomac |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
------------------------ไฟล์แรกค่ะ เป็นฟอมร์รับค่ะ index33
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Smart Upload</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<%
fid = Request.QueryString("fid")
act = Request.QueryString("act")
if act = "" Then act = "file"
If CStr(act) = CStr("file") Then
formaction = "upfile_s.asp"
piccolor = "#666666"
filecolor = "#FF0000"
End If
filecount = Request.QueryString("filecount")
If filecount = "" Then filecount = 0
If CInt(filecount) < CInt(1) or CInt(filecount) > CInt(5) Then filecount = 1
%>
<link href="include/default_style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="include/default_javascript.js" type="text/javascript"></script>
</head>
</HEAD>
<BODY>
<H1>aspSmartUpload : Sample 1</H1>
<HR>
<FORM METHOD="POST" ACTION="upload11.asp" ENCTYPE="multipart/form-data">
<INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="FILE2" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="FILE3" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="FILE4" SIZE="50"><BR>
<INPUT TYPE="SUBMIT" VALUE="Upload">
<td valign="top">
<p><% If CStr(act) = CStr("file") Then%><br><font size="2" face="Tahoma" color="#A50203"><b>File
Description : </b></font><br><textarea name="filedesc" rows="4" cols="35" style="border-width:1pt; border-color:rgb(204,204,204); border-style:solid;"></textarea><br><% End If%><font size="2" face="Tahoma" color="#A50203"><b><br>File
Count <select name="filecount" size="1" onchange="selfilecount(document.frmupload.filecount.value);">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select><br></b></font><% If CStr(act) = CStr("file") Then%><br><font size="1" face="Tahoma" color="#666666"><b>Allow
File Type</b> : rar , zip<br><b>Allow File Size</b> : Maximum</font><font size="2" face="Tahoma" color="#666666"><b> 50
</b></font><font size="1" face="Tahoma" color="#666666">mb</font><% End If%><font size="2" face="Tahoma" color="#A50203"><b><br></b></font>
</FORM>
</BODY>
</HTML>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ไฟล์ upload11
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
<!--#include file="include/functions_hash1way.asp" -->
</head>
<body text="black" link="blue" vlink="purple" alink="red" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" background="images/bg-jens.jpg">
<table cellpadding="0" cellspacing="0" width="1000" align="center">
<tr>
<td width="200">
<p> </p>
</td>
</tr>
</table>
<p align="center"> </p>
<table align="center" cellpadding="0" cellspacing="0" width="400" style="border-width:1pt; border-color:white; border-style:solid;">
<tr>
<td>
<p><br>
<%
On Error Resume Next
' Variables
' *********
Dim mySmartUpload
Dim intCount
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Only allow txt or htm files
' ***************************
mySmartUpload.AllowedFilesList = "rar,zip"
' DeniedFilesList can also be used :
' Allow all files except exe, bat and asp
' ***************************************
' mySmartUpload.DeniedFilesList = "exe,bat,asp"
' Deny physical path
' *******************
mySmartUpload.DenyPhysicalPath = True
' Only allow files smaller than 50000 bytes
' *****************************************
mySmartUpload.MaxFileSize = 5242880
' Deny upload if the total fila size is greater than 200000 bytes
' ***************************************************************
mySmartUpload.TotalMaxFileSize = 5242880
' Upload
' ******
mySmartUpload.Upload
' Save the files with their original names in a virtual path of the web server
' ****************************************************************************
filedesc = mySmartUpload.form("filedesc")
userip = Request.ServerVariables("Remote_ADDR")
userip = Replace(userip,".","")
foldername = userip & day(now) & month(now) & year(now) & hour(now) & minute(now) & second(now)
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateFolder (Server.Mappath("upfile/"& foldername))
set f=nothing
set fs=nothing
strconn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db/upload.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn
Set rs=Server.CreateObject("ADODB.Recordset")
Sql="Select * From upload"
rs.Open Sql,Conn,1,3
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Save the files with his original names in a virtual path of the web server
' ****************************************************************************
file.SaveAs("upfile/" & foldername &"/" & file.FileName)
rs.AddNew
ID = rs("ID")
fid = hashencode(ID)
rs("fid") = fid
rs("filename") = file.FileName
rs("filedesc") = filedesc
rs("update") = date
rs("uptime") = time
rs.Update
%>
<table cellpadding="0" cellspacing="0" width="400">
<tr><td width="400"><p align="left"> </p></td></tr>
<tr><td width="400"><p>
<font size="2" face="Tahoma" color="#A50203"><b><%=file.FileName%></b></font><font size="2" face="Tahoma"><b> Download URL : </b><br>http://localhost/getfiles.asp?fn=<%=foldername%>&fid=<%=fid%></font>
</p></td></tr>
<tr><td width="400"><p> </p></td></tr>
</table>
<%
' Display the properties of the current file
' ******************************************
'Response.Write("Name = " & file.Name & "<BR>")
'Response.Write("Size = " & file.Size & "<BR>")
'Response.Write("FileName = " & file.FileName & "<BR>")
'Response.Write("FileExt = " & file.FileExt & "<BR>")
'Response.Write("FilePathName = " & file.FilePathName & "<BR>")
'Response.Write("ContentType = " & file.ContentType & "<BR>")
'Response.Write("ContentDisp = " & file.ContentDisp & "<BR>")
'Response.Write("TypeMIME = " & file.TypeMIME & "<BR>")
'Response.Write("SubTypeMIME = " & file.SubTypeMIME & "<BR>")
intCount = intCount + 1
End If
Next
rs.Close
Set rs = Nothing
conn.close
Set Conn = Nothing
' Trap errors
' ***********
If Err Then
Response.Write("<center><b><font face='Tahoma' size='3' color='red'>Wrong selection : " & Err.description & "</font></b></center>")
Else
' Display the number of files uploaded
' ************************************
Response.Write("<center><b><font face='Tahoma' size='3'>" & intCount & " file(s) uploaded.</font></b></center>")
End If
Response.Write(intCount & " file(s) uploaded.")
%>
<font face='ms Sans serif' size=-1>
Upload path :<%=filePath%><br>
file name : </b><%=filename%><br>
???????? : <%=detail%>
<p align="center"><font size="2" face="Tahoma"><b><a href="index13.asp?act=file">Upload
more file</a><br><br></b></font></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
------------------------------------------------------------------------------------------------------------------------------------------------------------
ไฟล์ getfiles
<html>
<head>
<title>giggle</title>
<%
fid = Request.QueryString("fid")
foldername = Request.QueryString("fn")
hcd = Request.QueryString("hcd")
hdl = Request.QueryString("hdl")
' Get file information from db
strconn ="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db/upload.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn
Set rs=Server.CreateObject("ADODB.Recordset")
Sql="Select * From upload"
rs.Open Sql,Conn,1,3
fl = 0
While Not rs.EOF and fl = 0
If CStr(rs("fid")) = CStr(fid) Then
filename = rs("filename")
filedesc = rs("filedesc")
If CInt(hcd) = CInt(0) Then rs("dlcount") = CLng(rs("dlcount")+1)
dlcount = rs("dlcount")
rs.Update
fl = 1
End If
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
conn.close
Set Conn = Nothing
%>
<% If CInt(hcd) = CInt(0) Then %>
<Script LANGUAGE="JavaScript">
<!-- Begin
var start=new Date();
start=Date.parse(start)/1000;
var counts=10;
function CountDown(){
var now=new Date();
now=Date.parse(now)/1000;
var x=parseInt(counts-(now-start),10);
if(document.form1){document.form1.clock.value = x;}
if(x>0){
timerID=setTimeout("CountDown()", 100)
}else{
document.form1.btndownload.disabled=false;
}
}
// End -->
</script>
<Script LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',100);
-->
</script>
<% End If %>
<Script language="javascript">
function godl()
{
document.form1.btndownload.disabled = true;
location.href="upfile/<%=foldername%>/<%=filename%>";
}
</script>
</head>
<hr width="80%" color="#F2F2F2">
<p align="center"><font size="2" face="Tahoma"><b><a href="index13.asp">Upload
File<br></a></b></font></p>
<hr width="80%" color="#F2F2F2"> <table align="center" cellpadding="0" cellspacing="0" width="400" style="border-width:1pt; border-color:white; border-style:solid;">
<tr>
<td>
<p><font size="2" face="Tahoma" color="#960001"><b>Filename :<br></b></font></p></td>
</tr>
<tr>
<td>
<p><font size="2" face="Tahoma"><%=filename%><br> </font></p></td>
</tr>
<tr><td>
<p><font size="2" face="Tahoma" color="#960001"><b>Description :</b></font></p></td>
</tr>
<tr>
<td>
<p><font size="2" face="Tahoma"><%=filedesc%><br> </font> </p></td>
</tr>
<tr>
<td>
<p><font size="2" face="Tahoma" color="#960001"><b>Total
Download : </b></font><font size="2" face="Tahoma"><%=dlcount%></font></p></td></tr><tr> <td>
<p> </p>
</td></tr> <tr>
<td>
<FORM NAME="form1">
<p align="center"><font size="2">Please
wait for
<INPUT TYPE="text" NAME="clock" SIZE="2" VALUE="10">
seconds.<br>
<br>
</font>
<input type="button" name="btndownload" value="Download File" onclick="godl();" disabled>
<font size="2"> </font>
</FORM>
</td></tr><tr><td>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
พอคลิกอัพโหลดมันก็ขึ้น
Exp075.rar Download URL :
http://localhost/getfiles.asp?fn=1270011520072648&fid=0000000000000000000000000000000000000000
Wrong selection : Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
1 file(s) uploaded. Upload path :
file name :
???????? :
งงงงงงงมากแล้วค่ะแก้แล้วต้องรีบส่งค่ะ ใครช่วยได้ช่วยหน่อยน่ะค่ะ
เราเก็บไฟล์ทังหมดอยู่ใน D:\interpub\wwwroot\
upload.mdb เป็นฐานข้อมูล มันมีปัญหาตรงไหนค่ะมันถึงไม่เจอไฟล์ที่อัพค่ะ
|
 |
 |
 |
 |
Date :
1 พ.ค. 2550 02:07:29 |
By :
แมว |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|