Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2009-04-30
Medium Priority
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
  • 2

Author Comment

ID: 24268461
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

Accepted Solution

Rajeshk_cgm earned 0 total points
ID: 24268559
I got the Solution, the folder is Exist.,


Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

571 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