hi..
m new to asp so my knowledge abt it is very limited
i m trying to connect to asp server using ftpwerquest class
this sud be able to access the files from the ftp server and display the name,size,type,time etc of the file on IE
if i copy the folder on my machine and run the code but i want the prog to take the folder path from the ftp server...so there is no need to copy the folders on my machine
is it possible???
pleaseeee hlp mw with it :sigh:
the code which works with out ftp class is
<b><pre lang="xml"><form method="POST" action="simpleform1.asp">
<br /><br /><br /><br />
<body background="C:/Documents and Settings/conference.bhopal/My Documents/My Pictures/indtextb.jpg" bgcolor="#F5F5F5" text="#696969" link="#191970" vlink="#4682B4" alink="#CD5C5C">
<table border="2" cellpadding="3" cellspacing="5" width="100%" height="1">
<tr>
<td width="100%" colspan="5" height="132">&nbsp;&nbsp;&nbsp;&nbsp; <img src="C:/Documents and Settings/conference.bhopal/My Documents/My Pictures/ftp.gif" width="900" height="189"></td>
</tr>
<tr>
<font face="Old English Text MT" color="#005C99" size="5"><b> Copy Folder Location From The System :<input type="text" name="folderlocation" /><br />
<br />
<input type="submit" value="Submit" /><br /><br /><br /><br /><br /><br />
<%
response.write(request.querystring("folderlocation"))
%>
</form></pre>
</b>
SIMPLEFORM.ASP is as follows
<b><pre lang="xml"><%
Dim fs,fo
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set fo=fs.GetFolder(Request.form("folderlocation"))
%>
<html>
<table border="1">
<tr bgcolor=#33ADD6>
<th>NAME</th>
<th>DATE</th>
<th>TIME</th>
<th>SIZE(bytes)</th>
<th>TYPE</th>
</tr>
</html>
<%
dim x
for each x in fo.files
%>
<tr>
<td><% Response.write (x.Name) %></td>
<td><% response.write formatdatetime(x.datecreated,2) %></td>
<td><% response.write formatdatetime(x.datecreated,3) %></td>
<td><% response.write(x.size & " bytes") %></td>
<td><% response.write(x.type)%></td>
</tr>
<%
next
Response.write("<br />")
dim y
for each y in fo.SubFolders
response.write("SUB FOLDERS ->")
Response.write(y.Name & "<br />")
next
set fo=nothing
set fs=nothing
%></pre>
</b>
ftp prog is as follows
Const localFile As String = "C:\myfile.bin"
Const host As String = "ftp://x.x.x.x./"
Const username As String = "******"
Const password As String = "******"
Dim URI As String = host & remoteFile
Dim ftp As System.Net.FtpWebRequest = _
CType(FtpWebRequest.Create(URI), FtpWebRequest)
ftp.Credentials = New _
System.Net.NetworkCredential(user***, Password**)
ftp.KeepAlive = False
ftp.UseBinary = True
ftp.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
Using response As System.Net.FtpWebResponse = _
CType(ftp.GetResponse, System.Net.FtpWebResponse)
Using responseStream As IO.Stream = response.GetResponseStream
Using fs As New IO.FileStream(localFile, IO.FileMode.Create)
Dim buffer(2047) As Byte
Dim read As Integer = 0
Do
read = responseStream.Read(buffer, 0, buffer.Length)
fs.Write(buffer, 0, read)
Loop Until read = 0
responseStream.Close()
fs.Flush()
fs.Close()
End Using
responseStream.Close()
End Using
response.Close()
End Using