Monday 15 April 2013

Set default file-name to uploaded file name


    <script language="javascript" type="text/javascript">
        // Don't forget to set the textbox clientid=Static
        function Upload_FileChanged(filepath, TextBoxID) {
            var TextBox_AttachmentName = document.getElementById(TextBoxID);
            if (TextBox_AttachmentName != null) {
                if (TextBox_AttachmentName.value == "") {
                    if (filepath != null) {
                        var filename = filepath.replace(/^.*[\\\/]/, '')
                        TextBox_AttachmentName.value = filename;
                    }
                }
            }
        }
    </script>

No comments:

Post a Comment