Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
function addFileInput() {

var fileName = document.getElementById("uploadFile").value;
 //alert("hi:"+fileName);

    self.parent.displaySmallDocs.location.href="display_small_documents_GUI.asp?retrieve=yes&count=yes&doctype="+sDocType+"&filelist=" + fileName;

}

function CheckFileName() {
        var fileName = document.getElementById("uploadFile").value
         if (fileName.split(".")[1].toUpperCase() == "TIF"){
        addFileInput();
        }
           // return true;
        else {
            alert("File with " + file.fileName.split(".")[1] + " is invalid. Upload a valid file with tif extensions");
            return false;
        }
        return true;
    }


html code
XML
<style type="text/css">
                 #container {
                    position: relative;
                    width: 4.00em;
                    height: 2.50em;
                    overflow: hidden;
                    background-image: url("../images/icons/search2.gif");
                    background-repeat: no-repeat;

                 }
                 #Search, #uploadFile {
                    position: absolute;
                    cursor: default;


                 }
                 #Search {
                    top: 0;
                    left: 0;
                    border: 1px solid #000;

                 }
                 #uploadFile {
                    opacity: 0.001;
                    font-size: 300%;
                    top: -5px;
                    right: -5px;

                 }

                    </style>
                    <!--[if IE]>
                    <style type="text/css">
                    #uploadFile {
                    filter:alpha(opacity=0.1);
                    }
                    </style>
                    <![endif]-->

                    <td>

                    <div id="container" title="Choose File">
                    <input id="uploadFile"  type="file" multiple  name='files[]' onchange="CheckFileName()"  >
                    <script language="javascript">
                        displayIcon("SearchButton","../images/icons/search2.gif","javascript:CheckFileName();","<%=Lan("SEARCH")%>");
                    </script>


please help if anyone knows it.
also need with file size validation
Posted

1 solution

Check out Dropzone JS[^]

Its customizable and could suit your needs.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900