Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,
Upload images means:

in web page contain: name, address, mobileno,email,password, confirmpassword,image.

here once enter name, address, mobileno,email,password, confirmpassword

and currently i dont have image after next time upload image option i want.

this optional upload image examples or logic please reply me
Posted
Comments
abdussalam143 13-Mar-14 2:37am    
did you try some thing.
Tom Marvolo Riddle 13-Mar-14 2:38am    
Not clear.explain the issue
member1431 13-Mar-14 2:47am    
Dear Jas,
name:textbox1.text
address:textbox2.text
mobileno:textbox3.text
Password:textbox4.text
ConfirmPassword:textbox5.text
email:textbox6.text
Image:fileupload control

here once fill the all textboxes
and without image store in database table

after next time upload image option in this web page

here i want optional with image and without image

please reply me any examples
member1431 13-Mar-14 2:50am    
i know uploading image and store in database table

but i want optional

please reply me jas
member1431 13-Mar-14 2:52am    
In this example uploading image mandatory

i want optional examples please reply me

It's pretty simple
Try something like this:
C#
if (Fileupload1.PostedFile.ContentLength != 0)
{
//insert with image
}
else
{
//insert without image
}

and for update get the ID and upload it
 
Share this answer
 
 
Share this answer
 
here is my fileupload project code

try it .. :)

protected void upload_Click(object sender, EventArgs e)
   {
       if (doctorfileupload.PostedFile != null)
       {
           string FileName = Path.GetFileName(doctorfileupload.PostedFile.FileName);
           Session["filename"] = FileName;
           //doctorfileupload.SaveAs(Server.MapPath("~/images2/" + FileName));
           string cont_name = "";
           cont_name = doctorfileupload.FileName;
           string path = Server.MapPath("~/BenImages/");
           doctorfileupload.SaveAs(path + cont_name);
           string FullPath = "~/BenImages/" + cont_name;
           Session["pathname"] = FullPath;
           imagedisplay.ImageUrl = FullPath;
       }
   }
 
Share this answer
 
Comments
member1431 13-Mar-14 5:01am    
Dear Jas,
this coding can't understand please modify and send me please
Tom Marvolo Riddle 13-Mar-14 5:06am    
assign default path to the else part
member1431 13-Mar-14 5:27am    
Dear Jas,
i got output thanks for your reply
Tom Marvolo Riddle 13-Mar-14 5:44am    
Most welcome!
SQL
if (Fileupload1.PostedFile.ContentLength != 0)
{
//insert with image
}
else
{
//insert without image
}
 
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