FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 12th, 2004, 08:13 AM
buddinghere buddinghere is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 23 buddinghere User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 40 sec
Reputation Power: 0
writing a file to a ftp server

Hi guys,
Could you please give a solution to this naive.
Actually i wanna write a new file on to a ftp server through my php script
and the contents of that file would be the contents wriiten in the textarea. of the form
which will be displayed on the client side.
Whatever the contents would be passed in that textarea will make a new file on the
ftpserver.
My main stress is over here how can i write the file on a ftp server having all the
contents for that file with me.
i am not asking about the uploading thing but we have to write a file on a ftp server with all permission given and we have the contents of that file in $_REQUEST['contents']
with us.
Please help guys,
Thanks
buddinghere

Reply With Quote
  #2  
Old February 12th, 2004, 10:36 AM
codergeek42's Avatar
codergeek42 codergeek42 is offline
[Insert clever comment here.]
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Jul 2003
Location: Anaheim, CA (USA)
Posts: 6,427 codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 2nd Grade (Above 100000 Reputation Level)  Folding Points: 39542 Folding Title: Starter FolderFolding Points: 39542 Folding Title: Starter Folder
Time spent in forums: 1 Month 1 Week 6 Days 7 h 37 m 26 sec
Reputation Power: 1141
Send a message via ICQ to codergeek42 Send a message via AIM to codergeek42 Send a message via Yahoo to codergeek42 Send a message via Google Talk to codergeek42
ftp:// wrapper maybe? or the FTP extension?

PHP Code:
<?php
//This line gets the form data posted to the script
$fileContents $_POST['contents'];

//These next few lines specify connection parameters for the FTP server.
$ftpServer "168.192.xxx.xxx";
$ftpUser "username";
$ftpPassword "********";
$fileName "path/on/server/to/file.txt";

//Then just go ahead and use the FTP wrapper for the filesystem functions.
$fileHandle fopen"ftp://{$ftpUser}:{$ftpPass}@{$ftpServer}/{$fileName}""w" );
fwrite$fileHandle$fileContents );
fclose$fileHandle );
?>
You may also want to look into using the FTP Extension.

Hope this helps!
__________________
~~ Peter ~~
( My Blog: It's exactly like normal nerdiness, but completely different. ) :: ( Supporter of the EFF & FSF ) :: ( I'm a GNU/Linux addict and Free Software Advocate. ) :: ( How to Ask Questions the Smart Way ) :: ( The Fedora Project, sponsored by Red Hat ) :: ( GNOME: The Free Software Desktop Project ) :: ( GnuPG Public Key )

Last edited by php4geek : February 12th, 2004 at 10:39 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > writing a file to a ftp server


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway