Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a file upload control and a button on button click file been uploaded

but if there are no file chosen then i want give a message "no file chosen" through required field validater
plz help

thank you.
Posted
Updated 16-Jun-14 21:08pm
v2
Comments
Abhishek Pant 17-Jun-14 2:48am    
http://stackoverflow.com/questions/46219/how-to-determine-if-user-selected-a-file-for-file-upload
neeraj_ 17-Jun-14 2:52am    
thanks abhishek for ur kind reply
Abhishek Pant 17-Jun-14 2:58am    
You can make alert if file is not present using javascript onclientclick if present do your task i mean return true to do the button click else return false or you can do the same from server side-
http://www.aspforums.net/Threads/152812/Verify-whether-File-Exists-when-uploading-using-FileUpload-control-in-ASPNet/
neeraj_ 17-Jun-14 3:05am    
abhishek actually i wants a message like required field validater
can i use required field validater for this issue
Abhishek Pant 17-Jun-14 8:54am    
see my answer for reference links about using required field validater

Hi U can get uploaded file count or length,if file length zero,then when button click event show msg

VB
 If (FileUpload1.FileName.Length = 0) Then 
'Show error msg
Else

End IF



Regards
Aravind
 
Share this answer
 
v2
Comments
neeraj_ 17-Jun-14 3:32am    
but i wants required field validater @Aravind
As of your requirement of required field validator:
This links may help you

How to validate FileUpload in asp.net [^]
Required field validator on asp:FileUpload control[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900