We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,473 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

File Uploarding

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

2
Contributors
2
Replies
20 Hours
Discussion Span
2 Years Ago
Last Updated
3
Views
umandajayo
Light Poster
45 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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();" />
sergb
Junior Poster
105 posts since May 2010
Reputation Points: 17
Solved Threads: 32
Skill Endorsements: 0

Thank you dear...

umandajayo
Light Poster
45 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0636 seconds using 2.73MB