TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rajasekhar kollapu
NA
3
878
File Upload Validation using Jquery
Feb 10 2016 4:40 AM
I am trying to upload the images with the extension jpg,png&gif. When I am using the following code I am able to upload png and gif images but unable to upload jpg images. Please Help me Out.
$.validator.addMethod("uploadfile",function(val,element){
var size=element.files[0].size;
console.log;
if(size > 1048576) {
console.log("returning false");
return false;
}
else {
console.log("returning true");
return true;
}
});
rules{
<%=fu.UniqueID%>:{
required:true,
accept:".jpg?g|.png|.gif",
uploadfile:true,
},
},
messages{
<%=fu.UniqueID%>:{
required:"Please Upload Image",
accept:"File should be JPG, GIF or PNG",
uploadfile:"File Size must be less than 1MB"
},
},
Reply
Answers (
1
)
How to Upload an audio file and play it using jQUERY
Partial view in a view