hi friends

how to check file upload control empty or not in javascript?

I m try to this way but it is not working

function Empty(){

var sValue.value = document.getElementById('file_input');

if(sValue == ""){
	alert("ERROR: Project Image Should be Uplorded..!.");
	sValue.focus();
	}

}


<input type="file" name="fileField" id="file_input" >
<input  type="button"  value="Send" name="Submit"  onclick="Empty()/>

thank you...

function Empty() {
    var element = document.getElementById('file_input');
    var sValue = element.value;
    if (sValue == "") {
        alert("ERROR: Project Image Should be Uploaded!");
        element.focus();
        return false;
    }
    return true;
}
<input type="file" name="fileField" id="file_input" />
<input type="submit" value="Send" name="Submit" onclick="return Empty();" />

Thank you dear...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.