Page 1 of 1

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

Posted: Tue Jan 28, 2014 4:42 pm
by Mark
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

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

Posted: Sat Feb 08, 2014 9:58 pm
by Simon
Hi Mark,
Have you tested this on larger (~2 MB) files yet?

Thanks,
Simon

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

Posted: Sun Feb 09, 2014 2:01 am
by Mark
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

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

Posted: Tue Feb 18, 2014 11:57 pm
by splash21
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 ;)

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

Posted: Wed Feb 19, 2014 12:01 am
by Mark
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

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

Posted: Wed Feb 19, 2014 12:03 am
by splash21
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.

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

Posted: Wed Feb 19, 2014 12:07 am
by Mark
I'll have a look.