@@ -191,6 +191,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_put, 0, 0, 4)
191191 ZEND_ARG_INFO (0 , startpos )
192192ZEND_END_ARG_INFO ()
193193
194+ ZEND_BEGIN_ARG_INFO_EX (arginfo_ftp_append , 0 , 0 , 4 )
195+ ZEND_ARG_INFO (0 , ftp )
196+ ZEND_ARG_INFO (0 , remote_file )
197+ ZEND_ARG_INFO (0 , local_file )
198+ ZEND_ARG_INFO (0 , mode )
199+ ZEND_END_ARG_INFO ()
200+
194201ZEND_BEGIN_ARG_INFO_EX (arginfo_ftp_nb_put , 0 , 0 , 4 )
195202 ZEND_ARG_INFO (0 , ftp )
196203 ZEND_ARG_INFO (0 , remote_file )
@@ -265,6 +272,7 @@ const zend_function_entry php_ftp_functions[] = {
265272 PHP_FE (ftp_get , arginfo_ftp_get )
266273 PHP_FE (ftp_fget , arginfo_ftp_fget )
267274 PHP_FE (ftp_put , arginfo_ftp_put )
275+ PHP_FE (ftp_append , arginfo_ftp_append )
268276 PHP_FE (ftp_fput , arginfo_ftp_fput )
269277 PHP_FE (ftp_size , arginfo_ftp_size )
270278 PHP_FE (ftp_mdtm , arginfo_ftp_mdtm )
@@ -1272,6 +1280,41 @@ PHP_FUNCTION(ftp_put)
12721280}
12731281/* }}} */
12741282
1283+ /* {{{ proto bool ftp_append(resource stream, string remote_file, string local_file, int mode)
1284+ Append content of a file a another file on the FTP server */
1285+ PHP_FUNCTION (ftp_append )
1286+ {
1287+ zval * z_ftp ;
1288+ ftpbuf_t * ftp ;
1289+ ftptype_t xtype ;
1290+ char * remote , * local ;
1291+ size_t remote_len , local_len ;
1292+ zend_long mode ;
1293+ php_stream * instream ;
1294+
1295+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "rppl" , & z_ftp , & remote , & remote_len , & local , & local_len , & mode ) == FAILURE ) {
1296+ return ;
1297+ }
1298+
1299+ if ((ftp = (ftpbuf_t * )zend_fetch_resource (Z_RES_P (z_ftp ), le_ftpbuf_name , le_ftpbuf )) == NULL ) {
1300+ RETURN_FALSE ;
1301+ }
1302+ XTYPE (xtype , mode );
1303+
1304+ if (!(instream = php_stream_open_wrapper (local , mode == FTPTYPE_ASCII ? "rt" : "rb" , REPORT_ERRORS , NULL ))) {
1305+ RETURN_FALSE ;
1306+ }
1307+
1308+ if (!ftp_append (ftp , remote , remote_len , instream , xtype )) {
1309+ php_stream_close (instream );
1310+ php_error_docref (NULL , E_WARNING , "%s" , ftp -> inbuf );
1311+ RETURN_FALSE ;
1312+ }
1313+ php_stream_close (instream );
1314+
1315+ RETURN_TRUE ;
1316+ }
1317+ /* }}} */
12751318
12761319/* {{{ proto int ftp_nb_put(resource stream, string remote_file, string local_file, int mode[, int startpos])
12771320 Stores a file on the FTP server */
0 commit comments