File Upoad Using Javascript

Ganeshji
Posted by in ASP.NET category on for Beginner level | Points: 250 | Views : 5829 red flag
Rating: 3 out of 5  
 1 vote(s)

Here i have shown how to check the extensions of the file which are being browsed by the FileUpload control.

Introduction


In this small article, i have tried to show u, how to check the extension of a file which is being browsed by the FileUpload control.
                          Sometimes we may need to check the extension of the file browsed, in our client side only. Then we can use the following javascript function.

Javascript Function




OnClientClick event of the Button Control




Output


If a .jpeg/.bmp/.png file is selected, then the following output comes.




If a .doc/.docx file is selected, then the following output comes.


If no file is browsed, yet user clicks the button, then the following output comes.



Conclusion

Happy Coding!

Page copy protected against web site content infringement by Copyscape

About the Author

Ganeshji
Full Name: Zinnia Sarkar
Member Level:
Member Status: Member
Member Since: 7/24/2010 12:50:40 PM
Country: India
Regards, Ganeshji


Login to vote for this post.

Comments or Responses

Posted by: Sandeep_merapost on: 1/28/2011 | Points: 25
nice atricle
Posted by: Prabhakar on: 1/29/2011 | Points: 25
Gud Article ... It's a new for uploading files in Website
Posted by: Ganeshji on: 1/29/2011 | Points: 25
Thnx Prabhakar and Sandeep for reading it! Keep on suggesting plz.

Login to post response

Comment using Facebook(Author doesn't get notification)