 |
|
ASP เขียนโค้ด connect ftp server แล้วเกิด error ครับ |
|
 |
|
|
 |
 |
|
สวัสดีครับ ผมเขียนโค้ด asp เพื่อ ไป get file จาก ftp server แต่เกิด error โค้ดที่ผมเขชียน
Code (ASP)
<%@ LANGUAGE=VBScript %>
<!--#Include File="aspftp2.inc"-->
<%
'check to see if user submitted form
If Request.Form("GetIt") <> "" Then
Dim objFTP
Dim strMsg
'create reference to object
Set objFTP = Server.CreateObject("NIBLACK.ASPFTP")
'now get the file
If objFTP.bQGetFile(Request.Form("Server"), Request.Form("User_ID"), _
Request.Form("Password"), Request.Form("Remote_File"), _
Request.Form("Local_File"), Request.Form("Transfer_Type"), _
Request.Form("OverWrite")) Then
'get was successful
strMsg = "Get Successful!"
Else
'get failed...let user know
strMsg = "Get Failed: " & objFTP.sError
End If
'clean up...
Set objFTP = Nothing
Else
'default return msg
strMsg = ""
End If
%>
<html>
<body>
This example uses the "quick" Get method (bQGetFile). All parameters
required for receiving a file are entered by the user in the
form below.<br>
<hr>
<br>
<%If strMsg <> "" Then%>
Return Message: <%=strMsg%><br>
<hr>
<br>
<%End If%>
<form action="AspFTP2_QGet_form.asp" method="post">
<table border="0" cellspacing="10">
<tr>
<td>Server/Host Name:</td>
<td><input name="Server" size="25"></td>
</tr><tr>
<td>User ID:</td>
<td><input name="User_ID" size="25"></td>
</tr><tr>
<td>Password:</td>
<td><input name="Password" size="25"></td>
</tr><tr>
<td>Remote File Name:</td>
<td><input name="Remote_File" size="25"></td>
</tr><tr>
<td>Local File Name:</td>
<td><input name="Local_File" size="25"></td>
</tr><tr>
<td>File Type:</td>
<td><select name="Transfer_Type">
<option value="1">ASCII</option>
<option value="2">Binary</option>
</select></td>
</tr><tr>
<td>Overwrite Existing File?</td>
<td><input name="OverWrite" type="radio" value="True" checked>True
<input name="OverWrite" type="radio" value="False">False</td>
</tr><tr>
<td colspan="2" align="center"><input type="submit" name="GetIt" value="Get File"></td>
</tr>
</table>
</form>
</body>
</html>
แล้วมันเกิด error ขึ้นข้อความว่า
Code
"An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error."
Tag : ASP, HTML/CSS, JavaScript, Windows, Web Service
|
|
 |
 |
 |
 |
Date :
2014-06-16 10:35:09 |
By :
wittawatsuwannarak |
View :
1654 |
Reply :
10 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่แน่ใจเหมือนกันครับ ผมก็ไปโหลด ตัวอย่าง บนเว็บ มาลอง รัน แต่มันไม่ไมี ไฟล์ NIBLACK.ASPFTP มาให้เลยครับ
|
 |
 |
 |
 |
Date :
2014-06-16 11:16:37 |
By :
wittawatsuwannarak |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันมี แต่ aspftp.dll ตัวนี้ อะครับ เว็บ ที่โหลดมา http://www.codeguru.com/vb/vb_internet/article.php/c19511/Creating-an-FTP-Component-in-Visual-Basic.htm
|
 |
 |
 |
 |
Date :
2014-06-16 11:22:51 |
By :
wittawatsuwannarak |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
นั่นแหละครับ เอาไป Register ก่อนครับ
|
 |
 |
 |
 |
Date :
2014-06-16 11:29:47 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
register แล้ว และก็ restart computer แล้ว แต่ก็ยังเหมือนเดิม
|
 |
 |
 |
 |
Date :
2014-06-16 11:38:12 |
By :
wittawatsuwannarak |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แสดงว่ามันไม่ใช่ DLL ของ NIBLACK.ASPFTP หรือ Version ไม่ Support กับ OS
|
 |
 |
 |
 |
Date :
2014-06-16 12:38:41 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอโทษนะครับ ตอนนี้เจอปัญหา ผมใช้ bQGetFile เพื่อ get file มาจาก ftp server ถ้าเกิด ผมใส่ จากโค๊ด
Code (ASP)
objFTP.bQGetFile(Request.Form("Server"), Request.Form("User_ID"), _
Request.Form("Password"), Request.Form("Remote_File"), _
Request.Form("Local_File"), Request.Form("Transfer_Type"), _
Request.Form("OverWrite")) Then
'get was successful
strMsg = "Get Successful!"
ตรง Request.Form("Local_File") = path ของเครื่องที่ทำเป็น server มันจะ get ไฟล์ ที่ต้องการ มาให้
แต่ถ้าสมติว่า ผมให้ computer A เป็น ftp server
computer B เป็น client แล้วผมรันเว็บ จากเครื่อง B
ถ้าผมใส่ Request.Form("Local_File") = "C:/Users/A/Desktop/New folder (2)/Sm.exe" path ของเครื่อง server มันจะ get file มาไว้ที่ C:/Users/A/Desktop/New folder (2)/Sm.exe ของ เครื่อง A ซึ่ง เป็นเครื่อง server
แต่ถ้าผมต้องการที่จะ get file มาไว้ที่ เครื่อง B ซึ่งเป็น client แต่ไม่สามารถ get file มาได้ แบบนี้ น่าจะมีสาเหตุมาจากอะไรครับ
|
 |
 |
 |
 |
Date :
2014-06-17 08:43:14 |
By :
wittawatsuwannarak |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|