What is the difference between ftp_fput vs ftp_put?

In PHP and its leadership, I can not clearly define the difference between ftp_fputvs ftp_put.

Can these two methods be clarified?

+5
source share
4 answers

ftp_fput()expects an open resource and ftp_put()just use the (local) file name

ftp_put($foo, $bar, $filename, $baz);
ftp_fput($foo, $bar, fopen($filename, 'r+b'), $baz);
+4
source
  • ftp_fput
    • "Upload from open file to FTP server"
  • ftp_put
    • "Uploads file to FTP server"

More specifically, it ftp_fputuses the resource created with fopen, as a file to load, where it ftp_puttakes the file name as a string.

+2
source

ftp_putrequires a file name, and a ftp_fputfile descriptor:

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);
+1
source

ftp_fput() lets start from a position in a file.

0
source

All Articles