Hi !!!
I am making a image upload form in asp.net c#..
and my code is for uploading is this
protected void btnupld_Click1(object sender, EventArgs e)
{
if (ListBox1.SelectedItem == null)
{
}
else
{
if (Page.IsValid && FileUpload1.HasFile)
{
string tmpname = ListBox1.SelectedItem.ToString();
ListBox1.Items.Insert(ListBox1.Items.IndexOf(ListBox1.SelectedItem), tmpname);
ListBox1.Items.RemoveAt(ListBox1.Items.IndexOf(ListBox1.SelectedItem));
Bitmap original_image = new Bitmap(FileUpload1.FileContent);
waterMarkImage(original_image, tmpname);
if (original_image != null)
original_image.Dispose();
}
}
}
protected void uploadmethod(Bitmap imgBmp, string tmpName)
{
string newName = System.IO.Path.ChangeExtension(tmpName,"gif");
imgBmp.Save(MapPath("~/add/" + newName));
Image1.ImageUrl = "~/add/" + newName;
}
here i changing the image extension and upload image on folder
this code is work in local machin is fine but when i upload on server i am face this error
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
string newName = System.IO.Path.ChangeExtension(tmpName,"gif");
string nameBy = System.IO.Path.GetFileNameWithoutExtension(newName);
imgBmp.Save(MapPath("~/add/" + nameBy + Path.GetExtension(newName)));
Image1.ImageUrl = "~/add/" + newName;
help
thanks in advance!!!!!