I am trying to read and write a remote a file to the user’s browser through CodeIgniter(FTP Class). That is, I want user to read the file edit the content and save it back.
One way will be
– download the file to my server
– read the file and echo to the user(Browser)
– Save the content of the file to local copy(My server)
– upload the file back to the server
But I don’t want to download the file to my server I just want to read and write to remote file
You can write it to the temporary file and after displaying just delete it using unlink() function in the same script. Just call it straight after echoing the content. The file will be present on your server for a really short period of time. FTP is used to upload files, but not for editing them remotely. Any FTP client supporting file edit is actually saving it to the temp folder on your computer and after the edit uploads it back to the server.