Closed ghost closed 11 years ago
I can confirm this issue ... it's not just filesize = 0 ... it's file = undefined
when it's passed to the validation... so it bugs out before that already.
it complains about 'wrong file type' or 'file size is zero' ... but the reason is = file = undefined.
Just have tested, not only the Android stock browser is affected - FireFox 4 has the same problem.
Think this issue might be related to this bug: https://bugs.webkit.org/show_bug.cgi?id=23933
Any chance to get synchronous AJAX calls for mobile browsers?
Firefox 4 works fine for me, but the stock browser on Android 2.3 and the webkit-based 'Midori' browser appear to exhibit the same problem.
At the very least, is there a way I can force those browsers to use the legacy iframe method until this gets straightened out?
Android browser doesn't support uploading. Nothing to do with this excellent project...
Android browser doesn't support uploading. Nothing to do with this excellent project...
Yes it does, at least as of 2.3, possibly earlier. I've been doing it all week. It even works with Blueimp's jQuery-File-Upload
edit: I've just tested, it even works with 2.2
It doesn't work on Adroid 2.3. I got the same error that says 'EmptyError.' Does anyone have an idea?
Thanks,
It works. Excellent!.
It stil won't work for me. Still get the EmptyError. I am on 2.3 on a Nexus one.
@ bayarmunkh how did you make it work?
I am not sure, is it a good idea. But, you can try.
In the _ValidtateFile section, change following thing.
} else if (size === 0){
this._error('emptyError', name);
return false;
To :
} else if (size == undefined){
this._error('emptyError', name);
return false;
It worked on my Android (My Touch 4G).
Thanks, Bayarmunkh
On Thu, May 19, 2011 at 12:04 PM, oviroa < reply@reply.github.com>wrote:
@ bayarmunkh how did you make it work?
Reply to this email directly or view it on GitHub: https://github.com/valums/file-uploader/issues/82#comment_1204844
Regards, Bayarmunkh chiigle@gmail.com chiigle@gmail.com Cell Phone: 641/233-0537
Didn't quite work. Error is gone but file doesn't get uploaded. Ideas?
On 5/19/11 10:12 AM, "bayarmunkh" reply@reply.github.com wrote:
I am not sure, is it a good idea. But, you can try.
In the _ValidtateFile section, change following thing.
} else if (size === 0){ this._error('emptyError', name); return false;
To :
} else if (size == undefined){ this._error('emptyError', name); return false;
It worked on my Android (My Touch 4G).
Thanks, Bayarmunkh
On Thu, May 19, 2011 at 12:04 PM, oviroa < reply@reply.github.com>wrote:
@ bayarmunkh how did you make it work?
Reply to this email directly or view it on GitHub: https://github.com/valums/file-uploader/issues/82#comment_1204844
Regards, Bayarmunkh chiigle@gmail.com chiigle@gmail.com Cell Phone: 641/233-0537
Reply to this email directly or view it on GitHub: https://github.com/valums/file-uploader/issues/82#comment_1204897
file = undefined ... that is the main problem.
tweaking the validation is just non-sense if there's nothing to validate.
Guys, I did this, and it works on my galaxy tab:
else if (size === 0){
// this._error('emptyError', name);
return true;
Only problem with this is that it screws up the cancel when you want to NOT upload after clicking upload... But I can live without it for a while! (the cancel while uploading still works) The problem is that Android browser(s?) are not reporting the file size... Not sure if it is an android issue, or a browser issue... is there a chrome for android?
haven't test this yet, but maybe it should be combined with a check for mobile browsers.
Yes, like in the case of the safari browser... Not exactly sure what to put though.
Here is the browser info on my Galaxy tab (with default browser and Gingerbread):
Thank you very much to solve the problem mate, I've added a few lines of code for just when browsing devices remove this._error androids ('emptyError', name) and return true. This is implemented:
_validateFile: function(file){
var name, size;
// Stores data from operating system and browser you are using.
var uagent = navigator.userAgent.toLowerCase();
var deviceAndroid = "android";
var deviceMobile = "mobile";
if (file.value){
// it is a file input
// get input value and remove path to normalize
name = file.value.replace(/.*(\/|\\)/, "");
} else {
// fix missing properties in Safari
name = file.fileName != null ? file.fileName : file.name;
size = file.fileSize != null ? file.fileSize : file.size;
}
if (! this._isAllowedExtension(name)){
this._error('typeError', name);
return false;
} else if ((size === 0) && ((uagent.search(deviceAndroid) > -1) || (uagent.search(deviceMobile) > -1))) {
return true;
} else if (size === 0) {
this._error('emptyError', name);
return false;
} ......
Many greetings to all.
Anyone confirmed the above patch/rewrite fixes it?
Confirmed, the above fixes the issue.
Confirmed too. Thanks Deivi.
I just change the
} else if (size == 0){
this._error('emptyError', name);
return false;
to
} else if (size == undefined){
this._error('emptyError', name);
return false;
and it worked fine for me ;)
It seems to me the Android 2.3 browser wrongly sets both the "size" and "fileSize" property of a selected file to zero. Tested with the SDK emulator and http://jsfiddle.net/VgZnh/ I find it odd that there seems no other discussion about this anywhere - does anyone see another reference/bug report?
I think the only workaround is to ignore size===0: https://github.com/cargomedia/file-uploader/commit/c727082f5b45b9c15c380d264ca4ce9587c90df7
@Deivi patch works also for me with Samsung Galaxy TAB. Thanks @Deivi :
Note that I will be fixing this for good, hopefully, in 3.1. I have identified this as a priority 1.
Will research this in 3.0.
I found an issue that prevented the response from being parsed in somewhat older Android versions. For example, in Android 2.3.6, xhr uploading is not supported, so Fine Uploader falls back to form submission. The stock Android browser (at least) adds the response as a child text node of <pre style="word-wrap: break-word; white-space: pre-wrap;">
. I noticed this in the javascript console of my Galaxy S2, which is running 2.3.6. IE 7-9 will add the response as a child text node of a <pre></pre>
, but without any attributes. The existing code that rips the response out of the <pre>
element didn't take into account the 2.3.6 case, so I modified it and all appears to work well now.
Note that I realize this is not the Android issue described in the headlining message of this case, but since the case is title "Doesn't work on Android", I thought I'd throw this fix in here.
I'm still. looking into the 0-size issue.
I'm having some trouble reproducing the 0-size file issue. I've attempted on both Android 2.3.6 and Android 4.0.4 (stock browsers on both). I uploaded several files, and while the file sizes were incorrect for files that were not locally stored, I was still able to upload. If someone is still seeing this issue, please re-open this case, report your version of Android, your browser, and the specifics of the file used to reproduce this. I'd hate to remove the 0-size check unless it is completely necessary. I suppose I could only disable this check if the UA string contains "Android", but I'd like some current reports from users that are experiencing this problem before I do so.
I used both 2.3.3 and 3.1 stock browsers with the demo webpage and only thing that fails is the sizeLimit parameter ie I can upload files that are bigger than that.
I tested with 2.3.6, same issue (I can upload files bigger than the sizeLimit). Other than that, everything seems to run ok.
Disclaimer: tested the Android versions only on the 2.1.2 and to-be-released 3.0 demo pages.
2.3.6, and presumably 2.3.3 as well, does not support the file api, so this is expected and unavoidable. On Nov 14, 2012 5:39 AM, "tellibus" notifications@github.com wrote:
I tested with 2.3.6, same issue (I can upload files bigger than the sizeLimit). Other than that, everything seems to run ok.
Disclaimer: tested the Android versions only on the 2.1.2 and to-be-released 3.0 demo pages.
— Reply to this email directly or view it on GitHubhttps://github.com/valums/file-uploader/issues/82#issuecomment-10363235.
Greetings,
When I try to use valums file uploader on Android, it doesn't work. Returns some error about the file being uploaded having a size of 0.