In PHP and its manual, i can't clearly find the difference between ftp_fput
vs ftp_put
.
ftp_fput
ftp_put
Can anyone clarify these two methods please?
ftp_fput()
expects an open resource and ftp_put()
just use a (local) filename
ftp_put($foo, $bar, $filename, $baz);
ftp_fput($foo, $bar, fopen($filename, 'r+b'), $baz);
More specifically, ftp_fput
takes a resource created with fopen
as the file to upload where as ftp_put
takes the filename as a string.
ftp_put
requires a filename, while ftp_fput
takes a file handle:
ftp_put($conn_id, "remote_file_name.txt", "local_file_name.txt", FTP_ASCII);
but
$file_handle = fopen("local_file_name.txt", "r");
ftp_fput($conn_id, "remote_file_name.txt", $file_handle, FTP_ASCII);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With