| | |
FTP problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2004
Posts: 2
Reputation:
Solved Threads: 0
Hi - very very new to PHP generally and as usual trying to run before I can walk. I have got the hang of single uploads but now need to use FTP to do multiples. I am now on day 1 of trying to work it out so I am still at silly question stage so please don't laugh. Also I'm self-taught so don't entirely grasp the jargon as my approach is take an example, alter it, see what happens and then work from there.
This code connects great and if I insert appropriate commands will read directory, create a directory etc etc but it simply will not upload. Any suggestions as to where I'm going wrong (please keep it simple).
<?php
$ftp_server="www.mydomain.co.uk";
$ftp_user_name="myname";
$ftp_user_pass="mypass";
$file="test.txt";
$remote_file="c:\dja\test.txt";
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
// close the connection
ftp_close($conn_id);
?>
This code connects great and if I insert appropriate commands will read directory, create a directory etc etc but it simply will not upload. Any suggestions as to where I'm going wrong (please keep it simple).
<?php
$ftp_server="www.mydomain.co.uk";
$ftp_user_name="myname";
$ftp_user_pass="mypass";
$file="test.txt";
$remote_file="c:\dja\test.txt";
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
// close the connection
ftp_close($conn_id);
?>
•
•
Join Date: Feb 2003
Posts: 282
Reputation:
Solved Threads: 6
Are you supposed to have a directory structure in the remote file?
![]() |
Similar Threads
- IIS V5.1 XP PRO (ftp problem) (Windows NT / 2000 / XP)
- Perl FTP Problem (Perl)
- FTP problem. (Python)
- ftp problem in win xp pc (Networking Hardware Configuration)
- FTP problem with IIS (Windows Servers and IIS)
- ftp problem...major please help (*nix Software)
Other Threads in the PHP Forum
- Previous Thread: how to use php with java script
- Next Thread: Php Mysql : Code for Multiple Field Search
| Thread Tools | Search this Thread |
# 5.2.10 access action address alexa apache api array auto autoincrement broken cakephp checkbox class classes clean clients cms code cron curl database date dehasher destroy directory dissertation domain dynamic echo$_get[x]changingitintovariable... email encode error errorlog fairness fatalerror file folder form function functions google href htaccess html image include indentedsubcategory ip javascript joomla legislation limit link load local login masterthesis memberships menu multiple multipletables mysql mysqlquery newsletters oop open passwords paypal pdf persist php popup provider query radio random script search secure server sessions simple sockets source space spam sql system table tutorial upload url user variable video voteup web youtube





