Return to Snippet

Revision: 61361
at December 7, 2012 16:33 by laxman2021


Initial Code
<script language="javascript">
        function Checkfiles()
        {
        var fup = document.getElementById('logo1');
        var fileName = fup.value;
        var ext = fileName.substring(fileName.lastIndexOf('.') + 1);
        if(ext == "gif" || ext == "GIF" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "JPG" || ext == "png" || ext == "PNG")
        {
        return true;
        } 
        else
        {
        alert("Upload JPG, JPEG, PNG, GIF images only");
        fup.focus();
        return false;
        }
        }
</script>


onchange="Checkfiles()"

Initial URL
http://programming-tut.blogspot.in/2010/02/javascript-validate-file-upload.html

Initial Description
Image file upload, javascript

Initial Title
Javascript : Validate file upload

Initial Tags
image, file

Initial Language
PHP