To get the file extension excluding the "." then do the following
@file_extension = file_name.split('.').pop()
To get the file extension along with "." then do the following
@file_extension = file_name.scan(/\.\w+$/)
Using Jquery
var ext = $('#file_field_id').val().split('.').pop().toLowerCase();
No comments:
Post a Comment