Tuesday, 31 July 2012

How to do file upload using javascript

Javascript Code as bellow:
function HandleBrowseClick()
{
var fileinput = document.getElementById("browse");
fileinput.click();
}

function Handlechange()
{
var fileinput = document.getElementById("browse");
var textinput = document.getElementById("filename");
textinput.value = fileinput.value;
}
Make the Input fields as:
input type="file" id="browse" name="fileupload"style="display:none"onChange="Handlechange();"
input type="text"   readonly="true" class="textmargin" id="filename"
input type="button" value="Browse.." id="browse" onclick="HandleBrowseClick();"

No comments:

Post a Comment