Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi I have two file upload control in one page, when i dont use second fileupload control and i click submit button,i see this message:

Could not find a part of the path 'path...'.
Line 19: FileUpload2.SaveAs("" + Server.MapPath("..//") + "\\my images path/\\" + FileUpload2.FileName);


i want when i don't use second file upload control,any thing not add in my database,and not show any error!
please help me...TNX
Posted
Comments
Vi(ky 8-May-14 4:43am    
make sure FileUpload2 reuied property is false and In database FileUpload2 field NULL allow
sajad379 8-May-14 5:08am    
I don't use RequiredFieldValidator in fileupload and in my database FileUpload2 field NULL allowed.i want when i don't use second file upload control,any thing not add in my database,and not show any error
DamithSL 8-May-14 4:45am    
what you have in line 19? where exactly you want to save uploaded files
sajad379 8-May-14 4:58am    
pic uploaded in in folder and path image stored in database
Sunasara Imdadhusen 8-May-14 5:26am    
Can you please provide code snippet for the same!

1 solution

That's a simple check on the FileName property:
C#
if (!string.IsNullOrEmpty(FileUpload2.FileName))
{
    //your code for saving the image on the server etc.
}
 
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