Revlet save a txt file

Richard Gaskin ambassador at fourthworld.com
Tue Jul 28 14:12:27 EDT 2009


Howard Bornstein wrote:

> On Sun, Jul 26, 2009 at 12:51 PM, Richard Gaskin <ambassador at fourthworld.com
>> wrote:
>> Two ways to send data to a server are FTP and POST via HTTP.  From anything
>> running on a public client FTP would expose your password unnecessarily, so
>> using POST to send the data to a CGI would probably be the better option.
>  
> I have been wondering about this also and am confused as to why the standard
> read and write file commands would not work. The revlet is sitting in a
> directory on a server, just like a stack sits in a directory on your local
> hard disk. You want to read or write a file in a directory relative to the
> stack or revlet. So why wouldn't
> 
>  open file fpath for write -- where fpath is the directory your revlet is
> in, for example
>  write fld "data" to file fpath
>  close file fpath
> 
> work on the server just like it works on your local hard drive, especially
> if the plugin is supposed to support virtually all of Rev's commands?

With distributed systems like this the challenge is that there is no 
"there" there.  :)

That is, the revlet stack file is indeed sitting on the server, but in 
an inert form.  It's just a blob of binary data that the server copies 
to anyone who asks for it.

What's running in the browser is a copy of the file that's been 
downloaded over the web, hundreds or maybe thousands of miles away, on 
the client computer.

Since we can't have random web browsers altering files on our servers, 
no client process can write to a server file system directly. Instead we 
must go through some other intermediary process designed for such 
communication, like FTP, POST, or GET.  The latter two are most commonly 
use in web apps, and fortunately the Rev CGI engine makes it pretty easy 
to accept such data to do anything you want with it on the server side.

--
  Richard Gaskin
  Fourth World
  Revolution training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com



More information about the use-livecode mailing list