hi, i want the name of the image selected by a user when uploading an image to be changed to his username.
wrote this code but the image stored gets corrupt every time..
protected void Button1_Click(object sender, EventArgs e)
{
String imagefolder="images";
String path;
String savepath;
if (FileUpload1.HasFile)
{
path = Path.Combine(imagefolder, Request.PhysicalApplicationPath);
savepath = Path.Combine(path, User .Identity .Name .ToString ());
FileUpload1.SaveAs(savepath);
Label1.Text = "Done";
Response.Redirect("userprofile.aspx");
}
else
{
Label1.Text = "Select a file";
}
}