Firstly you need to get 2 components (both written by Jeff Mastry). They are
FTP.WSC and SHELL.WSC. Both of which are probably only a maximum of 10 kb in
total (probably less). Then you will need to have them successfully
registered on that machine (like any other activex control). You can find
and download these from http://cwashington.netreach.net/.
Once you have these both complete you can write script like the following.
>
Dim oFTP
Set oFTP = CreateObject ("FTP.WSC")
With oFTP
.Host = ftp.myisp.net
.Username = "me" ' default it anonymous
.Password = "pwd" ' default is also anon (e-mail address)
.FtpExecute "put x:\path_1\path_2\file.ext"
End With
Set oFTP = Nothing
<
AFAIK this should work inside ASP pages with no problems.
Dominic
"Michael" <mma...@ntwo.com> wrote in message
news:OrSNr2U...@cppssbbsa02.microsoft.com...
Mike
"Dominic Marks" <dominic_marks*@hotmail.com> wrote in message
news:e68cZUVOAHA.244@cppssbbsa04...
Dominic (call me Dominic, Mr. Marks is scary :)
"Michael" <mma...@ntwo.com> wrote in message
news:eA8GYac...@cppssbbsa02.microsoft.com...
Carl or Groucho?
Mike
"Dominic Marks" <dominic_marks*@hotmail.com> wrote in message
news:#uDHHKfOAHA.252@cppssbbsa05...
> You should search for it.
>
> Dominic (call me Dominic, Mr. Marks is scary :)
>
"Al Dunbar" <Al_D...@HoTMaiL.com> wrote in message
news:suud01a...@corp.supernews.com...
>
> "Dominic Marks" <dominic_marks*@hotmail.com> wrote in message
> news:#uDHHKfOAHA.252@cppssbbsa05...
> >
> > You should search for it.
> >
> > Dominic (call me Dominic, Mr. Marks is scary :)
>
> Carl or Groucho?
"Dominic Marks" <dominic_marks*@hotmail.com> wrote in message
news:#$qllqfO...@cppssbbsa02.microsoft.com...
Are you using the components I reccomended or some others?
Dominic
"Michael" <mma...@ntwo.com> wrote in message
news:eZpu2yf...@cppssbbsa02.microsoft.com...
> Dominic - Any thoughts on why the file may not get to the ftp destination?
>
>
> "Dominic Marks" <dominic_marks*@hotmail.com> wrote in message
> news:#$qllqfO...@cppssbbsa02.microsoft.com...
> > As yet undecided :)
> >
"Michael" <mma...@ntwo.com> wrote in message
news:uSDQPzf...@cppssbbsa02.microsoft.com...
>
> I know that the ftp destination is written in correctly
>
<%
tempfile = Now()
tempfile = replace (tempfile, "/", "")
tempfile = replace (tempfile, ":", "")
tempfile = replace (tempfile, " ", "")
response.write tempfile
filename = tempfile & ".log"
set FSO = Server.CreateObject("Scripting.FileSystemObject")
set myFile = FSO.CreateTextFile(Server.MapPath(filename), 8, true)
MyFile.WriteLine "This is gonna work"
myFile.Close
set myFile2 = FSO.CreateTextFile(Server.MapPath("test.ftp"), 8, true)
myFile2.WriteLine "open ftp.somewhere.com" & chr(13)
myfile2.WriteLine "user UserName Password" & chr(13)
myfile2.WriteLine "put ../FTP/" & filename & "ExpoShop/" & filename
myfile2.WriteLine "quit"
Set WshShell = Server.CreateObject("WScript.Shell")
runStr="%comspec% /c ftp -n -v -d -s:test.ftp>logfile.txt"
rc=WshShell.Run (runStr, 0, TRUE)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<%
'FTP_TRANSFER_TYPE_ASCII = 1
'FTP_TRANSFER_TYPE_BINARY = 2
'Set FtpConn = Server.CreateObject("AspInet.FTP")
'if FtpConn.FTPPutFile("ftp.somewhere.com", "UserName", "Password",
"test.txt", "test.txt", FTP_TRANSFER_TYPE_BINARY) then
' Response.Write "<p>FTP upload Success...<br>"
'else
' Response.Write "<p>FTP upload Failed...<br>"
' Response.Write "Last Eror was: " & FtpConn.LastError
'end if
%>
</body>
</html>
For obvious reasons some items have been changed. The remmed out code
produces the result
FTP upload Failed...
Last Error was: 0
The unremmed code only produces the filename with the response.write
Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/
Michael wrote:
>
> <%@ Language = "VBScript"%>
>
> <%
> tempfile = Now()
> tempfile = replace (tempfile, "/", "")
> tempfile = replace (tempfile, ":", "")
> tempfile = replace (tempfile, " ", "")
> response.write tempfile
> filename = tempfile & ".log"
> set FSO = Server.CreateObject("Scripting.FileSystemObject")
> set myFile = FSO.CreateTextFile(Server.MapPath(filename), 8, true)
>
> MyFile.WriteLine "This is gonna work"
> myFile.Close
>
> set myFile2 = FSO.CreateTextFile(Server.MapPath("test.ftp"), 8, true)
> myFile2.WriteLine "open ftp.somewhere.com" & chr(13)
> myfile2.WriteLine "user UserName Password" & chr(13)
In my experience, the inclusion of the Password on the same line as the
UserName does not work. I believe it must be on a separate line in the
script, i.e. ...
myfile2.WriteLine "user UserName" & vbNewline & "Password"
Also, I'd remove all of those Chr(13)'s since the Writeline method
provides them anyway.
> myfile2.WriteLine "put ../FTP/" & filename & "ExpoShop/" & filename
You are also missing a space between the first 'filename and the string
that names the target location in the preceding line, i.e. ...
myfile2.WriteLine "put ../FTP/" & filename & " ExpoShop/" & filename
This will result in the 'put' having only one argument instead of the
desired two.