Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Java Script Validation
WhatsApp
Joginder Banger
Nov 28
2014
1.1
k
0
0
When we are upload any image on server. Server Throw the Error Image format can't be accept. You can check the Extension of image both way one is JavaScript and another is C#. In this code we are learning how to check format.
You can below code Value is a filename of image with extension.
var
filelength = parseInt(value.length) - 4;
var
fileext = value.substring(filelength,filelength + 4);
if
(fileext.toLowerCase()!=
'.gif'
&& fileext.toLowerCase() !=
'.jpg'
&& fileext.toLowerCase() !=
'jpeg'
&&
fileext.toLowerCase() !=
'bmp'
&&
fileext.toLowerCase() !=
'png'
)
return
false
;
Java Script validation code
Up Next
Java Script Validation