| | |
prevent upload control from uploading a blank file
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2008
Posts: 41
Reputation:
Solved Threads: 0
hi, i have set a condition on the upload function
but if i press upload button when no file is selected it still uploads a blank file regardless of the "if' condition i set, does any1 know why this might be?
cheers
ASP.NET Syntax (Toggle Plain Text)
if (FileUploadControl1.PostedFile == null) { lblResult.Text = "Please select a file first"; } else { //upload a file }
but if i press upload button when no file is selected it still uploads a blank file regardless of the "if' condition i set, does any1 know why this might be?
cheers
Last edited by peter_budo; Feb 24th, 2009 at 7:28 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Dec 2008
Posts: 104
Reputation:
Solved Threads: 18
Try this:
if (FileUploadControl1.HasFile)
{
//upload a file
}
else
{
lblResult.Text = "Please select a file first";
} Falling down is not defeat...
Defeat is when you refuse to getup...
Defeat is when you refuse to getup...
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: Get treeview selected node using javascript
- Next Thread: Sys.Webforms.PageRequestManagerServerErrorEexception from deploy machine
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol advice ajax alltypeofvideos appliances application asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox click commonfunctions confirmationcodegeneration css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dialog dropdownlist dynamically edit expose feedback fileuploader fill flash form formatdecimal forms formview gridview gudi iframe iis javascript listbox login microsoft mono mouse mssql multistepregistration news numerical objects opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail rotatepage save schoolproject search security select sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking treeview unauthorized validatedate validation vb.net video videos virtualdirectory vista visualstudio web webapplications webdevelopemnt webprogramming webservice xsl youareanotmemberofthedebuggerusers





