User Contributed Notes FTP-Funktionen |
|
Paul Southworth
16-Mar-2000 09:27 |
|
If you are looking for a sketchy sample implementation of an FTP client
written in PHP, here is a free one:
|
|
sean at debugs dot org
26-Dec-2000 08:21 |
|
Be careful when using ftp_size; some ftp servers report different results
depending on whether you have issued a BINARY or ASCII command first.
This is a bit of a drag because there appears to be no way of issuing
either command with these functions. Instead you must specify the
desired transfer type with each ftp_get or ftp_put. Thus for some
servers you will get a different number of bytes actually transfered than
that reported by the ftp_size function....... Yuk....
|
|
tgrk at hushmail dot com
25-Jan-2002 10:25 |
|
In case that your ftp connection using php failed(error msg is ftpbuf()..)
add first line before setting up ftp
connection:
$conn_id=0; $conn_id =
ftp_connect("$ftp_server");
|
|
sven at cartell-network dot de
13-Feb-2002 06:27 |
|
connection to a ftp server across proxy
$ftp_server =
"proxy"; f.e. 123.456.789.10 $ftp_user_name =
"username@ftpserver"; f.e.
[email protected] $ftp_user_pass =
"password";
$conn_id = ftp_connect($ftp_server,
2121); $login_result = ftp_login( $conn_id, $ftp_user_name,
$ftp_user_pass );
|
|
o_sheep at hotmail dot com
13-Mar-2002 07:15 |
|
you can try using
set_time_limit(0); which will reset the
timeout.
to find out what has been completed at at the php script..
you can try using flush(); after echo.. which should display your messages
without having to wait for the script to finish
loading..
"..I've got this working fine but with slow sites
and when sending a batch of files, the PHP times out! I am using a
commercial host so cannot tell them to increase the PHP timeout and in
any case I think that isn't appropriate.
I am thinking in terms
of first opening a connection and then sending each file with a reload
of the page (using a parameter to increment the file to be sent). This
could also give a "progress" indication rather than
freezing.
Is this sensible or can anyone suggest a better
approach?
Thanks.
Neil..."
|
|
will2025 at yahoo dot com
13-May-2002 10:51 |
|
Si teneis como respuesta ftpbuf 0 probar esto para conectar: $conn_id =
ftp_connect("127.0.0.1"); Parece absurdo pero me ha
funcionado en 2 servidores.
ftpbuf 0 ??? Try: $conn_id =
ftp_connect("127.0.0.1"); It works!!
|
|
NOSPAMkent at ioflux dot NOSPAM dot com
20-Sep-2002 12:05 |
|
I think what some other posts were trying to say which may need
clarification is that in PHP 4.2.3, ftp_connect("myhost.com")
was failing most of the time, except it would work like every few
minutes.
The fix is that ftp_connect seems to have a bug resolving
addresses. If you do:
$hostip = gethostbyname($host); $conn_id =
ftp_connect($hostip);
It seems to solve the problem. (Other
users referred to an ftpbuf() error... not sure what that is, but this
should fix it.)
|
|
(nospam) bool AT boolsite DOT net
10-Oct-2002 05:19 |
|
If you search for FXP (server to server FTP transfer), look at .
This
easy to use class is now able to do FXP transfer (v0.6.2) !!!!
|
|
Marius at lowvoice dot nl
22-Oct-2002 09:51 |
|
if you need to download a file into a string instead of into a file try
this:
$temp = tmpfile();
$conn_id =
ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $user,
$pass);
$fget_result=ftp_fget($conn_id, $temp, $ftp_file_name,
FTP_ASCII); ftp_quit($conn_id);
rewind
($temp); $FILE_DATA=fread($temp,$size); fclose($temp);
you
could also do this with fopen() but I found that using this function will
keep the connection open even after a fclose()!! So repeating this many
times will cause a lot of open ftp-connections.
|
|
vikas dot saxena at 4cplus dot com
25-Nov-2002 10:09 |
|
While using ftp_rmdir($conn, $userdir); I'm getting the following error
msg.
Unable to find ftpbuf 0
this message is showing where
ever $conn is being used.
|
|
eric at evilwalrus dot com
11-Jan-2003 05:14 |
|
There is no FTP command for the CHMODing of files, so you really have to do
it manually using ftp_exec(). I havn't tried this myself but I'm assuming
it should work, but here is an example of what I would do.
//After
we have connected to the FTP server //and need to set the perms for a
file/dir, use //this command if (ftp_exec($ftp_conn, 'chmod 0666
logs/log.txt')) echo 'Successfully set permissions for logs/log.txt
to 0666'; else echo 'Failed to set permissions for
logs/log.txt';
Again, I have not tested this, but I assume it would
work. Hope that helps.
|
|
php dot net at thedrewerys dot com
08-Feb-2003 10:25 |
|
To chmod, you need to use ftp_site instead of ftp_exec.
In the
example above, ftp_exec($ftp_conn, 'chmod 0666 logs/log.txt')
should be ftp_site($ftp_conn, 'chmod 0666 logs/log.txt')
|
|
arjenjb dot wanadoo dot nl
09-Mar-2003 05:29 |
|
Check
for a FTP server written in PHP. Supports Passive and Active FTP, and
all other standard FTP commands as decribed in RFC959.
|
|
|