image uploading in, Getting Generic error occurred in GDI+.

Hi, am trying to upload a image., with resize the image size and rename the image.,

previously it was working, but i have changed the imagename saving with the foldername.(u can understand by view the coding) am getting generic error.,

Plz., give me your suggesiton soon,
public string CheckExtension(FileUpload ltmpFileUpload)
        string lRtnValue = "";
        int moedelid = Convert.ToInt32(ddlModel.SelectedValue.ToString());
        string datename = DateTime.Now.ToString("yyyyMMddhhmmss ");
        string imgFileName = "";
        if (ltmpFileUpload.HasFile)
           if (lRtnValue == "")
                Bitmap originalBMP = new Bitmap(ltmpFileUpload.FileContent);
                int origWidth = originalBMP.Width;
                int origHeight = originalBMP.Height;
                int sngRatio = origWidth / origHeight;
                int newWidth = 500;
                int newHeight = 300;
                Bitmap newBMP = new Bitmap(originalBMP, newWidth, newHeight);
                Graphics oGraphics = Graphics.FromImage(newBMP);
                oGraphics.SmoothingMode = SmoothingMode.AntiAlias; oGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                oGraphics.DrawImage(originalBMP, 0, 0, newWidth, newHeight);
                imgFileName = Path.GetFileName(ltmpFileUpload.PostedFile.FileName.ToString());
                string Filename = datename + imgFileName;
                imgFileName = "Model" + moedelid.ToString() + "/" + datename + imgFileName;
                newBMP.Save(Request.PhysicalApplicationPath + "Upload\\Vehicles\\Model" + moedelid.ToString() + "\\" + Filename);
                lRtnValue = imgFileName;
            lRtnValue = "error";
        return lRtnValue;

Open in new window

Who is Participating?
Rajeshk_cgmAuthor Commented:
I got the Solution, the folder is Exist.,

Rajeshk_cgmAuthor Commented:
I thing i did mistake in escape sequence., while getting the imagename and saving it into the folder., but.. i have tried in all the cases still am getting error
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.