UPLOAD FILES EXCEPT THE FILES WITH NO EXTENSION

2 posts, 0 answers
  1. beeta one
    beeta one avatar
    63 posts
    Member since:
    Aug 2012

    Posted 16 Oct 2012 Link to this post


    Hii,
    How to allow users to upload all files except the files with no extension?

    thanks..
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Oct 2012 Link to this post

    Hi Hash,

    One suggestion is to check the uploading file's name in the OnClientFileUploading event as follows.

    JS:
    <script type="text/javascript">
     function OnClientFileUploading(sender, args) {
        var file = args.get_fileName();
        var extension = file.substr((file.lastIndexOf('.') + 1));
        if (extension == file) {
           args.set_cancel(true);
         }
      }
    </script>

    Hope this helps.

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top