Jump to content

File Upload


sridhar

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...