diff options
| author | Jason Greene <jason@php.net> | 2001-07-17 05:53:03 +0000 | 
|---|---|---|
| committer | Jason Greene <jason@php.net> | 2001-07-17 05:53:03 +0000 | 
| commit | 8eb5a4b856057e4188869e2064974d2ddae06555 (patch) | |
| tree | a86992261ad22fa27e3d278ee3a653d347b776f7 /ext/ftp/php_ftp.c | |
| parent | 18463f52a86b846f97f256adb5938f3141d8eee2 (diff) | |
| download | php-git-8eb5a4b856057e4188869e2064974d2ddae06555.tar.gz | |
@Added support for socket and popen file types to ftp_fput (Jason)
Diffstat (limited to 'ext/ftp/php_ftp.c')
| -rw-r--r-- | ext/ftp/php_ftp.c | 10 | 
1 files changed, 6 insertions, 4 deletions
| diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 130bee1776..f2ed4fe891 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -618,7 +618,8 @@ PHP_FUNCTION(ftp_fput)  	pval		*arg1, *arg2, *arg3, *arg4;  	ftpbuf_t	*ftp;  	ftptype_t	xtype; -	FILE		*fp; +	int		type; +	void		*rsrc;  	/* arg1 - ftp  	 * arg2 - remote file @@ -633,10 +634,11 @@ PHP_FUNCTION(ftp_fput)  	FTPBUF(ftp, arg1);  	convert_to_string(arg2); -	FILEP(fp, arg3); +   	rsrc = zend_fetch_resource(&arg3,-1,"File-Handle",&type,3,php_file_le_fopen(),php_file_le_popen(),php_file_le_socket()); +	ZEND_VERIFY_RESOURCE(rsrc);     	XTYPE(xtype, arg4); -	if (!ftp_put(ftp, Z_STRVAL_P(arg2), fp, xtype)) { +	if (!ftp_put(ftp, Z_STRVAL_P(arg2), (FILE*)rsrc, *(int*) rsrc, (type==php_file_le_socket()), xtype)) {  		php_error(E_WARNING, "ftp_put: %s", ftp->inbuf);  		RETURN_FALSE;  	} @@ -679,7 +681,7 @@ PHP_FUNCTION(ftp_put)  		php_error(E_WARNING, "error opening %s", Z_STRVAL_P(arg3));  		RETURN_FALSE;  	} -	if (	!ftp_put(ftp, Z_STRVAL_P(arg2), infp, xtype) || +	if (	!ftp_put(ftp, Z_STRVAL_P(arg2), infp, 0, 0, xtype) ||  		ferror(infp))  	{  		fclose(infp); | 
