sridhar Posted March 1, 2007 Share Posted March 1, 2007 Hi All,After selected the file in filetype text box, i need to check its file name or folder name. coz accidentally the user can remove the file name from text box. How can i convert it to readonly? how can i avoid it in client side, let me know.This is my file upload tag.<input name="batchfile" type="file" id="batchfile" size="50">Thank youSridhar.J Link to comment Share on other sites More sharing options...
webdreamer Posted March 1, 2007 Share Posted March 1, 2007 if u will make it read only user can not select the file or folderbetter u use javascript to validate it.webdreamer Link to comment Share on other sites More sharing options...
justsomeguy Posted March 1, 2007 Share Posted March 1, 2007 You can use Javascript to disable it when it changes. But they'll only be able to select a file once.<input type="file" onchange="this.disabled = true;"> Link to comment Share on other sites More sharing options...
sridhar Posted March 2, 2007 Author Share Posted March 2, 2007 You can use Javascript to disable it when it changes. But they'll only be able to select a file once.<input type="file" onchange="this.disabled = true;">Thank you, Its working fine, but one more thing If the user wants to select some other files. Its not possible in this method. Do u have any other logic. Link to comment Share on other sites More sharing options...
jesh Posted March 2, 2007 Share Posted March 2, 2007 Thank you, Its working fine, but one more thing If the user wants to select some other files. Its not possible in this method. Do u have any other logic.You could incorporate a "clear" or "reset" button that would enable the input again:<script type="text/javascript">function resetFile(){ var file = document.getElementById("file"); file.value = ""; file.disabled = false;}</script><input type="file" id="file" onchange="this.disabled=true;" /><button onclick="resetFile();">Reset</button> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now