SlickUpload
Welcome Guest Search | Active Topics | Log In | Register

EvaluateIsValid sample for UploadManagerRequiredFileValidator Options
rreddy7
#1 Posted : Thursday, June 19, 2008 4:46:08 PM
Rank: Newbie

Groups: Registered

Joined: 6/19/2008
Posts: 5
Can I get a sample of overriding EvaluateIsValid

UploadManagerRequiredFileValidator

I want to validate for type of files that it can process (*.gif, *.jpg) .

 

ChrisHynes
#2 Posted : Friday, June 20, 2008 1:13:01 PM
Rank: Administration


Groups:

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ
The required file validator won't let you validate the extension, only that at least one file is selected. We are working on an extension validator, which should be released next week.
rreddy7
#3 Posted : Friday, June 20, 2008 1:16:59 PM
Rank: Newbie

Groups: Registered

Joined: 6/19/2008
Posts: 5

Can't I use the property to get the name that user entered and look for extensions that I wanted and if not I will set the isvalid to false.

ChrisHynes
#4 Posted : Friday, June 20, 2008 1:51:36 PM
Rank: Administration


Groups:

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

If you want to write validation code like that by hand, using a custom validator, you can use the following function to get access to the iframe upload document:

function iframeDoc()
{
 var uploadManager = document.getElementById("<%=uploadManager.ClientID %>");
 var doc;

 if (uploadManager.contentWindow != null)
  doc = uploadManager.contentWindow.document;
 else
  doc = window.frames[uploadManager.id].document;

 return doc;
}

Change the uploadManager.ClientID reference to point to the ClientID property of the upload manager control on your page.

Using that, you can just call iframeDoc().getElementsByTagName("input") and filter through based on extension . Use a custom validator to encapsulate your validation code...

Users browsing this topic
Guest
Forum Jump  
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.