php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47792 I ttryd to upload 1 file to server but the error wil occur
Submitted: 2009-03-26 17:05 UTC Modified: 2009-03-26 18:16 UTC
From: ashraf_ker at yahoo dot com Assigned:
Status: Not a bug Package: FTP related
PHP Version: 5.2.9 OS: windows xp
Private report: No CVE-ID: None
 [2009-03-26 17:05 UTC] ashraf_ker at yahoo dot com
Description:
------------
the error is: 
1). ftp_put() expects parameter 1 to be resource, string given in  
D:\xampp\htdocs\ftp\testftp.php on line 10

2).  ftp_close() expects parameter 1 to be resource, string given in 
D:\xampp\htdocs\ftp\testftp.php on line 15







Reproduce code:
---------------
---
From manual page: faq
---
<?php
	//error_reporting(0);
	$conn_id="ftp.vidhyalokam.com";
	$destination_file="/public_html/test/";
	$source_file="NEWS";
	
	// ftp_pasv( $ftp, 1);

$upload= ftp_put($conn_id,$destination_file,$source_file,FTP_ASCII);
if (!$upload)
{echo"sorry, didn't work.";}
else
{echo"OK!";}
ftp_close($conn_id);

?>

Expected result:
----------------
Expecting that all the files of Directory "NEWS" upload to server in 
"/public_html/test/"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-26 18:16 UTC] kalle@php.net
You need to use ftp_connect to open an ftp resource before attempting to use any of the ftp functions.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon May 23 21:03:42 2022 UTC