Jump to content

PHP FTP Functions - Write to a file


Disturbed One

Recommended Posts

Hello,

 

I am trying to make a function where I use PHP's ftp command to grab the contents of a file, and write to that file replaced values.

 

I have the function down that grabs the code and replaces the values, but I don't know how to write the new code back to that file.

 

Ie.

The code to be inserted in the file is:

$data = "
<strong>Value has been replaced!</strong><br />
Congratulations!
";

 

Here is what I am attempting:

		if(!ftp_fput($con, getcwd().'/index.html', $data, FTP_ASCII))
		{
			echo "There was a problem while uploading ".getcwd()."/index.html\n";
		}

But that gives me this error: Warning: ftp_fput() expects parameter 3 to be resource, array given in /home/*protected*/public_html/admin/includes/classes/class.user.php on line 985

 

Any help would be appreciated!

 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.