|
Rank: Advanced Member Groups: Member
Joined: 6/14/2007 Posts: 36
|
Hi, I'm trying to validate the ajax uploader control before i post my form, to check if any files have been uploaded. Is it possible to access the postedfiles count on the client side? I want to check that the user has uploaded a file before they submit the form. I want to try something like this:
Code: JavaScript
var oUploader = eo_GetObject("AJAXUploader1");
if (oUploader.files.count == 0)
{
alert('fail');
}
Thanks, Dave
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
|
|
Rank: Advanced Member Groups: Member
Joined: 6/14/2007 Posts: 36
|
Hi, I tried:
Code: JavaScript
var i = oUploader.getTotalFileCount();
alert(i);
but this just returns null. Am I using it correctly? Regards, Dave
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Dave,
The function only returns value during an upload session ---- meaning an upload is actively in progress. Once the upload is done, it returns null. The primary purpose of this function is to support {total_file_count} variable in progress text. As such it appears that the function won't give you what you need. We will see if we can add that functionality.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 6/14/2007 Posts: 36
|
Thanks,
Ah i see what you mean. My goal here was really to avoid a roundtrip to the server to check if a file had been uploaded by the user.
Please let me know if you make this addition, as it will make my app more efficient :)
Cheers, Dave
|
|