Here's a tricky one! How to transfer a file from one Web server to another.

D

Darcy

I would like for an ASP page to transfer a text file (from the same
directory the ASP file is in) to another Web server.

I don't mind if the code is in ASP or VB.

Any ideas?

I suspect that there is a way of having an ASP page conduct an FTP session
to transfer the file.

I would like to do this without a component as I'm looking for source code.

Thanks in advance....

Darcy
 
R

Ray at

Flakey componentless way:

Create file on server with these contents and save it as something like
C:\ftpcommand.ftp

open 123.123.123.123
user REPLACETHISWITHYOURUSERNAME
REPLACETHISWITHYOURPASSWORD
lcd D:\LocalDirOnYourServer
cd RemoteDirectoryOnServer
type ascii
put asciifile.txt
type binary
put binaryfile.jpg
close
quit

Then execute this code:

Set oShell = CreateObject("WScript.Shell")
oShell.Run "%windir%\system32\ftp.exe -n -s:C:\ftpcommand.ftp", 0, False
Set oShell = Nothing

Ray at work

p.s. inetserver.asp.general is an active group. The other two that you
cross-posted to aren't.
 
D

Dominique

this way should work if ur working on ur own server instead of a sub-hosted
server.

Create:
Batch file to initiate ftp
ftpScript file with all ftp commands(login and put etc)
put them in the same directory

int the bat file:
=================
cd [path_to_bat_file]
ftp -s:ftpScript.ftp ftp.server.com
=================


in the ftpScript.ftp file:(everything on new lines)
=================
USERNAME
PASSWORD
cd REMOTEDIR
lcd PATH_TO_TEXTFILE
PUT txtFile.txt
on error quit
quit
=================

now on ur ASP page just:

set objShell = Server.CreateObject("WScript.Shell")
objShell.run PATH_TO_BAT_FILE, 0, True
set objShell = nothing

0 = don popup on console
True = wait till done

you can set this to false if you wanna

and ur done

lemme know if it works, sh!t i use it all the time to replicate files
between my servers overnite.
 
D

Darcy

Thank you that works!


Ray at said:
Flakey componentless way:

Create file on server with these contents and save it as something like
C:\ftpcommand.ftp

open 123.123.123.123
user REPLACETHISWITHYOURUSERNAME
REPLACETHISWITHYOURPASSWORD
lcd D:\LocalDirOnYourServer
cd RemoteDirectoryOnServer
type ascii
put asciifile.txt
type binary
put binaryfile.jpg
close
quit

Then execute this code:

Set oShell = CreateObject("WScript.Shell")
oShell.Run "%windir%\system32\ftp.exe -n -s:C:\ftpcommand.ftp", 0, False
Set oShell = Nothing

Ray at work

p.s. inetserver.asp.general is an active group. The other two that you
cross-posted to aren't.
 
D

Dominique

this way should work if ur working on ur own server instead of a sub-hosted
server.

Create:
Batch file to initiate ftp
ftpScript file with all ftp commands(login and put etc)
put them in the same directory

int the bat file:
=================
cd [path_to_bat_file]
ftp -s:ftpScript.ftp ftp.server.com
=================


in the ftpScript.ftp file:(everything on new lines)
=================
USERNAME
PASSWORD
cd REMOTEDIR
lcd PATH_TO_TEXTFILE
PUT txtFile.txt
on error quit
quit
=================

now on ur ASP page just:

set objShell = Server.CreateObject("WScript.Shell")
objShell.run PATH_TO_BAT_FILE, 0, True
set objShell = nothing

0 = don popup on console
True = wait till done

you can set this to false if you wanna

and ur done

lemme know if it works, sh!t i use it all the time to replicate files
between my servers overnite.
 
D

Dominique

this way should work if ur working on ur own server instead of a sub-hosted
server.

Create:
Batch file to initiate ftp
ftpScript file with all ftp commands(login and put etc)
put them in the same directory

int the bat file:
=================
cd [path_to_bat_file]
ftp -s:ftpScript.ftp ftp.server.com
=================


in the ftpScript.ftp file:(everything on new lines)
=================
USERNAME
PASSWORD
cd REMOTEDIR
lcd PATH_TO_TEXTFILE
PUT txtFile.txt
on error quit
quit
=================

now on ur ASP page just:

set objShell = Server.CreateObject("WScript.Shell")
objShell.run PATH_TO_BAT_FILE, 0, True
set objShell = nothing

0 = don popup on console
True = wait till done

you can set this to false if you wanna

and ur done

lemme know if it works, sh!t i use it all the time to replicate files
between my servers overnite.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top