On-Rev File Browser Upload Dialog

Richard Gaskin ambassador at fourthworld.com
Thu Oct 21 12:07:12 EDT 2010


Rick Harrison wrote:

> All I meant was that RevServer is the relatively new kid
> on the block, and I had hoped that it had the capability
> within it without relying on externals code such as
> java-script to get the job done in an easier way.

But in this case you're looking for oranges in an apple barrel:

RevServer runs on the server.  It can do a lot there, and many very 
interesting apps can be written natively in LiveCode without anything 
else at all.

That is, to the extent that the server side contributes to a 
client-server application.

That leaves the client side to be addressed, where your question was 
about the user interface for selecting a file.

On the client we have no choice:  the only scripting engine built into 
browsers is JavaScript.  That's it.  The good thing about that is you 
don't need to spend a lot of time deciding which language to use to make 
your client-side UIs, since you have no choice in the matter at all. :)

I suppose you could use the RevWeb plugin, but for all but a fairly 
limited subset of sites in which you have an unusually committed 
audience, downloading any plugin is a non-starter.

Earlier you found the input object to provide that for the user:
<input type="file" class="upload" name="fileX[]">

Use that in an HTML form and you're good to go.  Here's the relevant 
part of the HTML source from the page I use at my site for uploading files:

<form enctype="multipart/form-data" action="/cgi-t/mydropbox.cgi" 
method="post">
Send this file:
<input type="file" name="userfile">
<input type="submit" value="Send File">
<input type="hidden" name="email" value="dropbox at fourthworld.com">
</form>


Now you're left with the server side, where the uploaded data will come 
in as part of a multi-part form.

I believe the code for parsing that from the incoming data stream so you 
can write it to disk has already been provided by Mattias, in 
RevServer-ready LiveCode:

<http://mail.runrev.com/pipermail/use-revolution/2010-October/147067.html>

So now you have both the client and the server side parts you need.

Nothing left but to glue them together and enjoy. :)

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv



More information about the use-livecode mailing list