views:

107

answers:

5

Is it possible to do file operations from a script running on a different server than the files being operated on? That is, upload, move, rename, delete, create new, modify, etc.

How would I go about doing this?

+1  A: 

One way do to it would be through FTP.

Greg
That's perfect, and gives me a chance to play with caching. It's also got lots of overhead though -- connecting and disconnecting for every action -- is there a way to at least, say, get the contents of a remote directory? Or does that have to be via FTP also?
Carson Myers
A: 

You are basicallly describing WebDAV, which was created so that write-methods like those found in ftp could be done over HTTP.

I imagine it would be tricky to make a non-http file manager with PHP that was save and reliable.

There are several libraries for adding making WebDAV feasible in PHP, not that are core or standard extensions yet, though.

Anthony
+1  A: 

As far as I know, it can be done only by logging into the shell via the remote script and then executing the commands from within the shell, or maybe by using FTP from the remote script.

Another method would be:

Create scripts in the server which will accept parametres (POST data) and do operations based on the arguments that are supplied to it.

Alan Haggai Alavi
I like the scripts method, but is there a way to send data to the scripts without redirecting the browser to them?
Carson Myers
You can use a PHP library for requesting and sending data to the scripts.
Alan Haggai Alavi
Think you can point me in the right direction, library-wise?
Carson Myers
Please have a look at: http_post_data() - http://php.net/manual/en/function.http-post-data.php
Alan Haggai Alavi
Since I do not code in PHP, I am not aware of the libraries that suit this purpose. Sorry about that.
Alan Haggai Alavi
That link was all I was looking for, haha, so thank you
Carson Myers
Nice to know that it helped you. :-)
Alan Haggai Alavi
A: 

Not an answer by any stretch of the imagination, I'm just thinking out loud ...

If the computer with the files to be 'managed' shared the files through SAMBA, I wonder if a client could be implemented in PHP?

Then there's NFS.

pavium
A: 

yes, this is either possible through php’s ftp functions or the native file system functions.

i wrote one myself (myftphp <-- advertisment :D)

using the native filesystem functions there are always restrictions on permission management, but for managing files in a public directory it’s perfect

knittl