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

Posted on 2009-04-30
Last Modified: 2013-12-03
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

Question by:Rajeshk_cgm
    LVL 2

    Author Comment

    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
    LVL 2

    Accepted Solution

    I got the Solution, the folder is Exist.,


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now