1,105,263 Community Members

File Uploarding

Member Avatar
umandajayo
Light Poster
46 posts since Feb 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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...

Member Avatar
sergb
Junior Poster
105 posts since May 2010
Reputation Points: 7 [?]
Q&As Helped to Solve: 32 [?]
Skill Endorsements: 0 [?]
 
0
 
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();" />
Member Avatar
umandajayo
Light Poster
46 posts since Feb 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thank you dear...

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: