input type ="file" control for file uploading.
-
i want to apply filter so that only txt,doc,rtf files are seen . Others are not seen . Please let me know .
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
i want to apply filter so that only txt,doc,rtf files are seen . Others are not seen . Please let me know .
Hi dude... try it... ========================================================= function checkFileExtension(elem) { var filePath = elem.value; if(filePath.indexOf('.') == -1) return false; var validExtensions = new Array(); var ext = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase(); validExtensions[0] = 'txt'; validExtensions[1] = 'doc'; validExtensions[2] = 'rtf'; for(var i = 0; i < validExtensions.length; i++) { if(ext == validExtensions[i]) return true; } alert ('You Cant upload a '+ext.toUpperCase()+' file!'); return false; } ============================================================ * and now use this line in your code behind (this line used in VB.Net!!!) =========================================================== myfile.Attributes.Add("onchange", "return checkFileExtension(this);") ============================================================ :rolleyes: be cool...
-
Hi dude... try it... ========================================================= function checkFileExtension(elem) { var filePath = elem.value; if(filePath.indexOf('.') == -1) return false; var validExtensions = new Array(); var ext = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase(); validExtensions[0] = 'txt'; validExtensions[1] = 'doc'; validExtensions[2] = 'rtf'; for(var i = 0; i < validExtensions.length; i++) { if(ext == validExtensions[i]) return true; } alert ('You Cant upload a '+ext.toUpperCase()+' file!'); return false; } ============================================================ * and now use this line in your code behind (this line used in VB.Net!!!) =========================================================== myfile.Attributes.Add("onchange", "return checkFileExtension(this);") ============================================================ :rolleyes: be cool...
-
i want to apply filter so that only txt,doc,rtf files are seen . Others are not seen . Please let me know .