what is the path to upload a image on the web serve of my asp.net project ?
the image is shown when the project running in local host but when i hosted it on the web server.It is not showing.
I am giving the program to upload a file in local host.
Please help me what is the path should be for web site.
void sub(Object s, EventArgs e)
{
con.Open();
Int32 x = 0;string y = GetRandomString(x);
int y1=0;
string y2="Code";
string s1=t1.Text.Trim();
string m;
int r=0;
DataRow []rs;
rs=ds.Tables["joining"].Select("aname='" +s1+"'");
r=rs.Length;
if((File1.PostedFile!=null)&&(File1.PostedFile.ContentLength>0))
{
fn=System.IO.Path.GetFileName(File1.PostedFile.FileName);
fn=y+fn;
SaveLocation=Server.MapPath("~/Kamna Group Website/"+fn);
photo=SaveLocation;
com=con.CreateCommand();
com.CommandText="Insert into joining(aname,fathname,dob,pob,add1,mob,city,state,pcode,panno,nominee,relation,photo,bank,branch,account,acctype,intby,codno,doi,agent,point,refno) values('" + t1.Text.Trim() + "','" + t2.Text.Trim() + "','" + t3.Text.Trim() + "','" + t4.Text.Trim() + "','" + texta1.Value + "','" + t7.Text.Trim() + "','" + t5.Text.Trim() + "','" + t6.Text.Trim() + "','" + t8.Text.Trim() + "','" + t11.Text.Trim() + "','" + t9.Text.Trim() + "','" + t10.Text.Trim() + "','" + photo + "','" + t12.Text.Trim() + "','" + t13.Text.Trim() + "','" + t14.Text.Trim() + "','" + d1.SelectedItem.Text + "','" + t15.Text.Trim() + "','" + t16.Text.Trim() + "','" + t17.Text.Trim() + "','" + y2 + "','" + y1.ToString() + "','" + y + "')";
try
{
File1.PostedFile.SaveAs(SaveLocation);
com.ExecuteNonQuery();
System.Web.UI.WebControls.Label lbl1=new System.Web.UI.WebControls.Label();
lbl1.ForeColor=System.Drawing.Color.Blue;
lbl1.BackColor=System.Drawing.Color.Yellow;
lbl1.Text="You have joined us.We will contect you soon!";
ph1.Controls.Add(lbl1);
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
}
else
{
Response.Write("Please a file to upload");
}
con.Close();
}
private string GetRandomString(int seed)
{ const string alphabet = "abcdefghijklmnopqrstuvwxyz";
Random rnd = new Random((seed + DateTime.Now.Millisecond));
string result = rnd.Next(1000000, 9999999).ToString();
string alphaChar = alphabet.Substring(rnd.Next(0, alphabet.Length - 1), 1);
int replacementIndex = rnd.Next(0, (result.Length - 1));
result = result.Remove(replacementIndex, 1).Insert(replacementIndex, alphaChar);
return result;
}