请输入您要查询的百科知识:

 

词条 ftp_fput
释义

ftp_fput

(PHP 3>= 3.0.13, PHP 4 )

ftp_fput -- 上传一个已经打开的文件到 FTP 服务器

说明

bool ftp_fput ( resource ftp_stream, string remote_file, resource handle, int mode [, int startpos])

ftp_fput() 函数用来上传一个在已经打开的文件中的数据到 FTP 服务器,参数 handle 为所打开文件的句柄。参数 remote_file 为上传到服务器上的文件名。传输模式参数 mode 只能为 (文本模式) FTP_ASCII 或 (二进制模式) FTP_BINARY 其中的一个。

例子 1. ftp_fput()example
<?php
// open some file for reading
$file = 'somefile.txt';
$fp = fopen($file, 'r');
// connect to the server
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to upload the file
if(ftp_fput($conn_id, $file, $fp, FTP_ASCII)) {
echo "Successfully uploaded $file\";
} else {
echo "There was a problem while uploading $file\";
}
// close the connection and the file handler
ftp_close($conn_id);
fclose($fp);
?>注: 参数 startpos 只适用于 4.3.0 以上版本。

如果成功则返回 TRUE,失败则返回 FALSE

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/4 1:20:09