FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 12th, 2003, 12:08 AM
ZeRO ZeRO is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 64 ZeRO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Uploading a File Through FTP

How would I upload a file in C++ through ftp ? I've tried using ftp through system() but it lacks the options i need. Any help would be appreciated

Reply With Quote
  #2  
Old June 12th, 2003, 10:03 AM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is offline
Contributing User
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 3,864 dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 23 h 39 m 49 sec
Reputation Power: 462
In what OS?

Are you trying to launch the FTP session from within the program? And then have it run automatically (ie, not interactively)?

If so, could you do the same thing in a script? I ask because I've done FTP interactively before, so I know that there is a login procedure and then a series of commands to send. Do you already know a way to do all that within a script? Under Linux/UNIX, that would sound like a job for Expect, which allows you to script sessions with interactive applications -- sorry, I've no actual experience with it.

And what options do you need that system() could not provide?

Last edited by dwise1_aol : June 12th, 2003 at 10:05 AM.

Reply With Quote
  #3  
Old June 12th, 2003, 10:25 AM
ZeRO ZeRO is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 64 ZeRO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
its under UNIX, (linux, freebsd, darwin) and im using the plain old ftp client. The c++ has the username, password, host, and path stored in variables, i was going to have system excute it all on the ftp program, but ftp doesnt support anything other than specfying the host. And it cant run interactively as it needs to run from cron.

Reply With Quote
  #4  
Old June 12th, 2003, 11:09 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 36 m 16 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
This can be done from a bash script easily enough.
I do this quite often on RH and using crons to download/upload files to/from a remote server.

Code:
#!/bin/sh
#These can be edited.
SERVER=your_server_ip
FTP=/usr/kerberos/bin/ftp
getfile=file_to_get_from_server


#Do not edit below this line. 
script=`basename ${0}`.ftp

echo 'user username password' > $script
echo 'verbose' >> $script
echo 'ascii' >> $script
echo 'cd /path/to/file' >> $script
echo "get ${getfile}" >> $script
echo 'bye' >> $script
date > ${script}.log
$FTP -n -u $SERVER < $script >> ${script}.log

rm -f $script                                                                                                                               

Last edited by Onslaught : June 12th, 2003 at 11:13 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Uploading a File Through FTP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT