简体   繁体   中英

PHP FTP put created zip file

If I try to run this code to upload a new zip file

$zip = new ZipArchive();
$zip->open("file.zip", ZipArchive::CREATE);
ftp_fput($ftp_conn, "file.zip", $zip, FTP_BINARY);

It displays the error:

Warning : ftp_fput() expects parameter 3 to be resource

How to put a zip file in ftp?

ftp_put working as follows

ftp_put(ftp_connection,remote_file,local_file,mode,startpos);

In your case

ftp_put($ftp_conn, "file.zip", "file.zip", FTP_BINARY);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM