i am trying to upload image and store it in file system in asp.net using c#. i am using this code
if (FileUpload1.HasFile)
{
if ((FileUpload1.PostedFile.ContentType == "image/jpeg") ||
(FileUpload1.PostedFile.ContentType == "image/png") ||
(FileUpload1.PostedFile.ContentType == "image/tmp") ||
(FileUpload1.PostedFile.ContentType == "image/gif"))
{
if (Convert.ToInt64(FileUpload1.PostedFile.ContentLength) < 10000000)
{
string filename = Label1.Text;
FileUpload1.SaveAs(Server.MapPath("productImage\\" + ddlproductId.Text + "\\" + filename + ".jpg"));
}
}
}
it actually work fine in my computer but while i am uploading it on server it get some error. please help me. thanking you.