What if there's no way to upload a file to a server?

Find out what's going on with LiveCode (the company), product releases, announcements, and events.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

What if there's no way to upload a file to a server?

Post by Mark » Tue Jan 28, 2014 4:42 pm

Hi,

More than once, the question has been asked how to upload files to a server from a mobile device. An important problem is that sockets aren't supported by default and a bug on Android preventing pictures from being saved to an album or attached to an e-mail. You might use Dropbox or a similar service, but requiring your customers to use an additional service doesn't give a very professional impression.

I have created a very simple LiveCode+PHP library, which uploads small files to a server. It might also work with bigger files, but I haven't tested this yet. This library works on any Android/iOS device and also works on desktop machines with any operating system.

There is no documentation yet and the current version is quite crude. No security has been implemented yet. If you're curious, you might want to have a look. If you need an off-the-shelve solution, then maybe not yet.

The library can be downloaded at http://qery.us/43p after making a donation (or if you made a donation less than 1 year ago). Currently, our server doesn't send e-mails automatically and you may have to wait up to 24 hours to get access to the private downloads.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: What if there's no way to upload a file to a server?

Post by Simon » Sat Feb 08, 2014 9:58 pm

Hi Mark,
Have you tested this on larger (~2 MB) files yet?

Thanks,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: What if there's no way to upload a file to a server?

Post by Mark » Sun Feb 09, 2014 2:01 am

Hi Simon,

I have now tested it with a 600K file. This works fine, although slowly, because I upload small pieces at a time. You can tweak the script, e.g. to upload 256 bytes instead of 64 bytes at a time. If you do this, you may need to change something in your PHP.ini file to allow for longer URL's.

Note that although everything works, the scripts are still in an experimental state. You'll need to spend some time to figure out how it works. I will upload a new version with my test scripts soon.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Re: What if there's no way to upload a file to a server?

Post by splash21 » Tue Feb 18, 2014 11:57 pm

Hi, Mark - you should use POST instead of GET - you can send far more data that way and avoid the overhead of all those small connections ;)
LiveCode Development & Training : http://splash21.com

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: What if there's no way to upload a file to a server?

Post by Mark » Wed Feb 19, 2014 12:01 am

Splash,

I would have used POST if it were possible. Unfortunately, libUrlMultipartFormData doesn't work on Android, so I might as well use GET.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Re: What if there's no way to upload a file to a server?

Post by splash21 » Wed Feb 19, 2014 12:03 am

It is possible - check out http://forums.runrev.com/viewtopic.php?f=8&t=19144

I've been using it on an android tablet for large uploads.
LiveCode Development & Training : http://splash21.com

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: What if there's no way to upload a file to a server?

Post by Mark » Wed Feb 19, 2014 12:07 am

I'll have a look.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Announcements”