LC Android File saving

David Brooks dbrooksne at
Thu May 5 12:11:46 EDT 2016

Saving files from Android devices to external servers has presented
challenges in the past. This is a SIMPLE approach. It assumes you are
running LiveCode server on the server site. Installing this requires a
careful procedure described elsewhere (see and references therein). The
on-rev site runs this software, so posting this file to the on-rev server
should be enough (untested).

On the server, you have a file


put $_POST["tFileName"] into tTheNewFileName
put $_POST["tFileText"] into tFileText
put tFileText into URL("file:"&defaultFolder&"/"&tTheNewFileName)


This will place the new file in the same folder as the

On the Web-connected Android app you have something (like a button)
executing this script:

  on mouseUp
      put (line 2 of fld "theFileName") into tFileName
      put URLencode(tFileName) into tFileName
      put fld "RecordFile" into tFileText
      put URLencode(tFileText) into tFileText
      post ("tFileName="&tFileName&"&tFileText="&tFileText) to URL "
   end mouseUp

While the security of this approach is poor and there is no error checking,
it does get you started. Because LC allows easy manipulation of text,
saving text files often beats saving in databases.

It is a GREAT DEAL EASIER to accomplish this simple task in desktop apps
using statements like put thisFile into URL (this location). You don't have
to manage the server side (assuming writing permissions are set properly).

Methods using other server-side approaches (like php) are described
elsewhere, too.

More information about the Use-livecode mailing list