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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ashraf_ker at yahoo dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 11:01:34 2025 UTC