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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
9 - 3 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC