Page 1 of 1

File transfer question

Posted: Wed Apr 05, 2017 4:43 pm
by Rob van der Sloot
Is it possible from within LiveCode to copy a file from a server to a pc.
I am updating runtimes regularly.
And put the runtimes on the server of the client.
The users on their pc's need to upload that new runtime.
It would be very userfriendly if by opening the old runtime it would automatically check for updates and then transfer the new runtime to the local folder on the pc.

Thanks
Rob van der Sloot

Re: File transfer question

Posted: Wed Apr 05, 2017 5:05 pm
by Klaus
Dag Rob,

is this really a "Database" question? 8)

Anyway, sure this is possible!
Check "load URL" or "liburldownloadtofile" in the dictionary.

Basically one could put a tiny text file on the server with (only) the version number of the EXE on the server in it.
Store the version number into a custom property of your apps.
Then download the small text file, check it against the stored version number and if there is a newer version on the server load that one to a folder on disk.

Hope that helps!


Best & groetjes

Klaus

Re: File transfer question

Posted: Wed Apr 05, 2017 5:19 pm
by FourthWorld
What platforms does your app run on? And are these updates over the public Internet, or on an internal network?

Re: File transfer question

Posted: Wed Apr 05, 2017 8:26 pm
by Rob van der Sloot
The runtime stack is put on a local windows server and has to transferred to a windows 10 pc.
Its an internal network.
But I think it would be easier to put it on a FTP server.

With load URL, the file is put in the cache, but I want it in a specific folder where other files also are part of the whole system.

I tried this:

load URL "\\f-server\public\mams\Runtime\MAMS1.0\MAN1.0\Management.exe" with message "Done"
but nothing happens

Re: File transfer question

Posted: Wed Apr 05, 2017 8:46 pm
by Klaus
Hi Rob,

since you mentoned "server" I immediately presumed you also mean a HTTP server, so "load" or "liburldownloadtofile" may fail in this case. 8)
Try this (and use the forward slash, as Livecode uses this internally on ALL platforms):

Code: Select all

...
put url("binfile://f-server/public/mams/Runtime/MAMS1.0/MAN1.0/Management.exe") into url("binfile:C:/path/to_local/folder/Management.exe")
if the result <> EMPTY then
  answer "Error:" && the result
end if
...
Best

Klaus

Re: File transfer question

Posted: Sun Apr 09, 2017 11:02 am
by MaxV

Code: Select all

put URL (http://www.example.com/myFile.jpg) into URL "binfile:/home/max/Documents/myFIle.jpg"

Re: File transfer question

Posted: Sun May 07, 2017 9:48 am
by Rob van der Sloot
Thanks a lot for the information.
I was a view weeks doing something else, but am back now on this project and with the binfile setup, it works just as I wanted.

All the best
Rob