473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ftp file transfer

omerbutt
638 512MB
hi i am stucked some where inthis work never did it before
i some how not getting some path right , i am getting the warning
Warning: ftp_fput() expects parameter 3 to be resource, string given in C:\xampp\htdocs\ews\projects\image-magick\imageMagick\ftp-chk.php on line 91
Expand|Select|Wrap|Line Numbers
  1. class Ftp{        
  2.         function ftpTransfer($ftpstream,$ftp_user,$ftp_pass,$ftp_new_file,$ftp_path){
  3.             //Login to the FTP server
  4.             $login = @ftp_login($ftpstream, $ftp_user, $ftp_pass);
  5.             if($login) {
  6.                 //We are now connected to FTP server.
  7.                 echo "switching to $ftp_path<br />";
  8.                 if(!ftp_chdir($ftpstream,$ftp_path)){
  9.                     echo "Could not switch to the remote directory<br />";
  10.                 }
  11.                 if(!chdir("C:/xampp/htdocs/ews/projects/image-magick/imageMagick/")){
  12.                     echo "Could not switch to the local directory<br />";
  13.                 }
  14.                 //Create a temporary file
  15.                 if($this->getFiles($ftp_new_file,$ftpstream)){
  16.                     return true;
  17.                 }else{
  18.                     return false;
  19.                 }
  20.             }else{
  21.                 echo "Could not Login to the remote site";
  22.             }
  23.         }
  24.         function getFiles($ftp_new_file,$ftpstream){
  25.             $source_file =    "INFO.txt";
  26.  
  27.             //Upload the file to server
  28.             if(ftp_fput($ftpstream, $ftp_new_file, $source_file, FTP_ASCII)){
  29.                 return true;
  30.             }else{
  31.                 return false;
  32.             }
  33.         }
  34.     }
  35.     $myFtp=new Ftp();
  36.     /*    START    */
  37.     $server_name="omaraslam.com";
  38.     $ftp_user='';
  39.     $ftp_pass='';
  40.     $ftp_path="/public_html/examples/";
  41.     $ftp_new_file=$ftp_path."omer.txt";
  42.  
  43.     //Open stream
  44.     $ftpstream = @ftp_connect($server_name);
  45.  
  46.     //Transfer Files Via Ftp
  47.     $A=$myFtp->ftpTransfer($ftpstream,$ftp_user,$ftp_pass,$ftp_new_file,$ftp_path);
  48.  
  49.     if($A){
  50.         echo "Success transferred!<br />";
  51.     }else{
  52.         echo "Failure!<br />";
  53.     }
  54.     //Close FTP connection
  55.     ftp_close($ftpstream);
  56.     echo "Operation Completed";
  57.  
regards,
Omer Aslam
Sep 21 '10 #1

✓ answered by code green

It looks like you are using the function parameters for ftp_put() but using the function ftp_fput()
Expand|Select|Wrap|Line Numbers
  1. ftp_fput(resource $ftp_stream, string $remote_file, resource $handle)
  2. ftp_put (resource $ftp_stream, string $remote_file, string $local_file)

2 3710
code green
1,726 Expert 1GB
It looks like you are using the function parameters for ftp_put() but using the function ftp_fput()
Expand|Select|Wrap|Line Numbers
  1. ftp_fput(resource $ftp_stream, string $remote_file, resource $handle)
  2. ftp_put (resource $ftp_stream, string $remote_file, string $local_file)
Sep 21 '10 #2
omerbutt
638 512MB
yeah
it was it i found it yesterday
anyways thanks alot for your concern
regards,
Omer Aslam
Sep 22 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David | last post by:
I've written a pair of client/server programs to do file transfer over a network. Pretty simple, really: server grabs the file up into an array of bytes, then waits for the client to contact it. ...
2
by: Steve Mack | last post by:
I was downloading from the MSDN subscription site and used the File Transfer Manager, and was wondering if that was something I could use for my site? Is there an API that allows me to build this...
1
by: Neel Word | last post by:
I need to develop an application (development platform: Win2000; target platform: Win98/ME/NT4/2000/XP), which would require file transfer functionality over dial-up and network. We could...
6
by: clintonG | last post by:
After the last six days trying to download VS2005 Professional it seems there may be a problem with my instance of the File Transfer Manager (FTM) or somewhere in the network in between. I can't...
3
by: Papanii | last post by:
Hi Guys, I am a newbie to the whole dot net framework and need a few pointers. I want to create an file transfer program (i.e form PC to PC) but i don't know where to start. Can anyone point me...
2
by: Grey | last post by:
i have used asp.net to transfer a file from one server to another . i use the system.io.file.copy to copy the file. But i want to know that how can assure the file is transfer complete?? Do i need...
10
by: David | last post by:
I have googled to no avail on getting specifically what I'm looking for. I have found plenty of full blown apps that implement some type of file transfer but what I'm specifcally looking for is an...
5
by: raghubr | last post by:
Hi all, Can any one pls guide me through..I need to transfer the file from server to client and client to server using sockets in an Asynchronous mode so this file transfer doesn't hinder the...
0
by: fiona | last post by:
Yucca Valley, CA, - October 2007: Catalyst Development Corporation, publisher of SocketTools, SocketWrench and LogicGem, today announced the release of Catalyst File Transfer .NET V5.0. For...
2
by: kashifjawed | last post by:
I'm developing a c# asynchronous socket application for tranfering file or large data from client to server and server to client as well in chunks. Application sometimes transfer file from client...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.