Ajax FileUpload not working from Android 2.3 device.

538 views
Skip to first unread message

Josh Berry

unread,
Apr 3, 2012, 7:56:19 PM4/3/12
to lif...@googlegroups.com
I'm trying to make a fairly basic web app where users can upload
images and I used the starting point of
https://github.com/dpp/starting_point/tree/ajax_upload. It works
wonderfully everywhere but on Android 2.3 devices. (I don't have
newer devices to test with. Haven't tried it in emulator.)

The only real customization that I can think of that I did was that I
am doing this from an ajax form, so I have to have a script repopulate
the "action" tag of the form on page load. I do note that there is an
open bug for the plugin about min size of the file. I tried that
locally with no success. (And the demo for the plugin works.)

Has anyone else had success with this scenario?

The complete app is available at
http://code.google.com/p/commuters-connect/. I should warn that this
has been my main learning point for lift, so I think I am doing some
things less than optimally. (So, if anyone has some suggestions, I'm
all ears!! :) )

Thanks!

Augustus Kling

unread,
Apr 4, 2012, 3:08:56 PM4/4/12
to lif...@googlegroups.com
I doubt you're getting file transfers to work via AJAX on Android 2.3 devices – it simply does not support the required File API. I think the required API is available as of Android 4.
For an explanation what I simply called API refer to Mozilla's samples where it says “Using FormData object” in https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest.

Depending on what level of error handling you require, it might be possible to replace the AJAX transmission with an ordinary form POST to an iframe.

Hope that helps.

Josh Berry

unread,
Apr 4, 2012, 3:49:57 PM4/4/12
to lif...@googlegroups.com
On Wed, Apr 4, 2012 at 3:08 PM, Augustus Kling <augustu...@gmail.com> wrote:
> I doubt you're getting file transfers to work via AJAX on Android 2.3
> devices – it simply does not support the required File API. I think the
> required API is available as of Android 4.
> For an explanation what I simply called API refer to Mozilla's samples where
> it says “Using FormData object” in
> https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest.

Makes sense. I should have said the JQuery FileUpload. The device I
have seems to work on the demo page, though I must confess I am not
sure if I have the latest jquery on my webapp now (something I didn't
think of till just now.) I'll check that as soon as I get a moment.
I did just get a chance to try it from ICS, and that seems to work no
problems.

> Depending on what level of error handling you require, it might be possible
> to replace the AJAX transmission with an ordinary form POST to an iframe.

I really was only going to utilize this as an extremely pleasant
surprise for working. With just a few css changes, this app was "just
working" on an android, which I found incredibly nice.

My suspicion for it not working was that it looks like it my require
the enctype=multipart that lift:form.ajax strips out of my form tag.
I was hoping others had encountered that and I was just oblivious.
(Actually, I should make sure that setting the action of the form
element to a legitimate value won't cause other troubles. Is that a
bad idea?)

Thanks!

Reply all
Reply to author
Forward
0 new messages