Krystalware
SlickUpload | Documentation | Demos | Purchase | Free Stuff | Forums | Blog | Testimonials | Company | Contact

Krystalware Support Forums

Welcome Guest Search | Active Topics | Log In | Register

File Name Validation Options
augie.comas@johnsongroup.com
#1 Posted : Tuesday, February 09, 2010 4:27:55 PM
Rank: Newbie

Groups: Registered

Joined: 10/31/2008
Posts: 3

Chris,

I am tyring to perform some validation as files are added to reject certain characters in the file name. I am hooking into the FileAdded javascript to do a regex match against it. This so far is working ok, the issue I am having is removing the file from the list if it fails the regex. I also am seeing some issue with the upload getting to 100% but then getting "Upload attempted but no status found" exceptions. I am trying to find out when this is happening since it does not appear to be hitting the page on postback.

I have the following (and I know it is not right):

function FileAdded(file) {
var fname = file.fileName;
 var myreg = /^[0-9a-zA-Z\.\(\)-_ ]*$/;
 if (!myreg.test(fname)) {
   var fs = kw.get('<%=uplArt.ClientID %>');
   fs.remove_file(file.id);
 }

}


Then the control:

                    <kw:SlickUpload ID="uplArt" runat="server" MaxFiles="-1" OnUploadComplete="upl_UploadComplete"
                        OnClientFileAdded="FileAdded">
                        <DownlevelSelectorTemplate>
                            <input type="file" />
                        </DownlevelSelectorTemplate>
                        <UplevelSelectorTemplate>
                            <input type="button" value="Add File" />
                        </UplevelSelectorTemplate>
                        <FileTemplate>
                            <div style="padding: 5px; height: 30px;">
...

 

ChrisHynes
#2 Posted : Wednesday, February 10, 2010 8:10:28 PM
Rank: Administration


Groups: Administrators

Joined: 7/7/2005
Posts: 1,341
Location: Arlington, VA

That looks like it should work. The only issue I see is that you have remove_file and the casing is actually remove_File. Try changing that, and let me know if that works.

The "Upload attempted but no status found" exception is caused when you refresh the page after an upload has completed. We've removed that for the next version as it was getting in the way rather than providing good information. The attached build should solve that issue.

File Attachment(s):
SlickUpload-5.4.3-AJAXFix.zip (56kb) downloaded 2 time(s).
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.