Welcome Guest Search | Active Topics | Sign In | Register

AjaxUploader File count on client side? Options
David Porter
Posted: Sunday, November 25, 2007 9:09:29 PM
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
eo_support
Posted: Sunday, November 25, 2007 9:17:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
David Porter
Posted: Sunday, November 25, 2007 9:46:57 PM
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
eo_support
Posted: Sunday, November 25, 2007 10:04:28 PM
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

David Porter
Posted: Sunday, November 25, 2007 10:09:32 PM
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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.