logo

New Response

« Return to the main article

You are replying to:

    • avatar
    • ibips
    • Posted on Wed 21 Apr 2004

    Hi,

    I have a fix for this, involved changing couple of line of the original code :

    Basically what this does is just cheking the extension of the file (without the dot) and also it will take extensions in caps (ie. '.GIF' or '.Gif' or '.JPg' etc)

    fileType = dots[dots.length-1].toLowerCase();

    if (fileTypes.join(" ").indexOf(fileType) != -1)

    I'm marking the lines changed with >>>>

    <script type="text/JavaScript"> <!-- Begin function TestFileType( fileName, fileTypes ) { if (!fileName) return;

    dots = fileName.split(".") //get the part AFTER the LAST period. >>>>fileType = "." + dots[dots.length-1];

    >>>>return (fileTypes.join(".").indexOf(fileType) != -1) ? alert('That file is OK!') : alert("Please only upload files that end in types: \n\n" + (fileTypes.join(" .")) + "\n\nPlease select a new file and try again."); } // --> </script>

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: