Deliver snapshot png graphic to a server

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Ron Zellner
Posts: 106
Joined: Wed May 31, 2006 9:56 pm
Contact:

Deliver snapshot png graphic to a server

Post by Ron Zellner » Wed Nov 04, 2009 11:52 pm

Is it possible to create a snapshot and send it to a folder on a server?
I know it can be done with sql, but I'd like them to get uploaded as a file.

Would this be the same solution as the " PDF File Upload" question on October14.
http://forums.runrev.com/phpBB2/viewtopic.php?t=3861

The main issue is how to handle the ID & Password.

Thanks.

oliverk
Site Admin
Site Admin
Posts: 53
Joined: Mon Feb 27, 2006 2:16 pm

Re: Deliver snapshot png graphic to a server

Post by oliverk » Wed Dec 16, 2009 11:51 am

Hi Ron,

You could use the put into url "ftp://..." method as described in the "PDF File Upload" thread. Using this method the username and password are coded into the actual url. I would suggest if you are using this approach, create an ftp account on your host specifically for this purpose, and make it very restrictive. In particular don't allow it to overwrite or read existing files and restrict it to a specific upload directory which has nothing important in it.

Another approach that is more flexible and gives you the possibility of more security options is to create an upload page on your server that deals with upload requests. This could be done in whatever language your server supports, PHP or IREV would both work fine. The rough idea here is to use the "post" command in Revolution, something like:

Code: Select all

local tUploadData
put "snapshot1.png" & return & "password" & return & tPNGData into tUploadData
post tUploadData to url "http://www.myserver.com/upload.php"
tUploadData could contain extra stuff at the beginning to allow a password, filename etc to be supplied. For example you could say line 1 is the filename you want to give the PNG file, line 2 is the password and line 3 to the end is the png data itself.

The script on your server would then simply read from stdin, extract the password and filename, and assuming all is ok, write the file out. Using this method you have the option to make things more secure if needed, by encrypting the data for example using a key which both the Rev app and upload page know.

Note that these are just ideas, you'll need to do a bit of experimentation to get it working and get the behavior / security features you need.

Regards
Oliver
Oliver Kenyon
Software Developer
Runtime Revolution

Post Reply