Author Topic: Useing Commandto* functions for file transfer.  (Read 490 times)

I can read and write to a file. Now I just need to take the file and send it from a client to a host. Here is my question. It's little derpy but BEAR though this.
Here is my write to file function
Code: [Select]
function ServerCmdwriteToFile(%filename, %content)
{
%outFileHandle = new FileObject() ;

%outFileHandle.openForWrite(%filename) ;

%outFileHandle.writeLine(%content) ;

%outFileHandle.close() ;
%outFileHandle.delete() ;
}
My question is that if I the client side I call
Code: [Select]
commandToServer("ServerCmdwriteToFile","my doc.txt","I can speak"); will that write the file on the Clients host computer or the Servers host computer?

Thanks,
Rarw

if you call commandToServer('writeToFile', "base/my doc.txt", "I can speak"); (notice the 3 changes I made) it will run the serverCmd on the server side.
That means the file will be written on the server host computer.

There's also the problem that %filename will actually be a client object.

Not to mention that if you're going to be actually using this for file transfer, you will be creating, opening, closing, and deleting potentially thousands of FileObjects.

goddamn
I always forget the first argument is client when I'm debugging other people's code
I always catch it when I'm making my own

Sorry lug I'm writing all this from my iPad so expect errors. Anyways I want the client to write to the host. The idea is for admins to patch a running server. (Eval + This)

I'll edit the generic names to avoid conflict.