Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8403501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:21:42+00:00 2026-06-09T22:21:42+00:00

I used multi file upload to upload file in ASP.Net without issues. But now

  • 0

I used multi file upload to upload file in ASP.Net without issues. But now i want to add more functionality like creating thumbnails while uploading below is my code:

try
        {
            string _path = "~/photos/realimg/";
            string _thumPath = "~/photos/thumbimg/";
            // Get the HttpFileCollection
            HttpFileCollection hfc = Request.Files;
            for (int i = 0; i < hfc.Count; i++)
            {
                HttpPostedFile hpf = hfc[i];
                if (hpf.ContentLength > 0)
                {
                    _path += System.IO.Path.GetFileName(hpf.FileName);
                    _thumPath += System.IO.Path.GetFileName(hpf.FileName.Insert(0, "thumb_"));
                    hpf.SaveAs(Server.MapPath(_path));
                    SavePicPath(_path);
                    System.Drawing.Image realImg = System.Drawing.Image.FromFile(Server.MapPath(_path));

                    Int32 rH = realImg.Height;
                    Int32 rW = realImg.Width;

                    Int32 fW = 170;
                    Int32 fH = (Int32)Math.Floor((double)rH * (fW / rW));
                    System.Drawing.Image thumbimg = realImg.GetThumbnailImage(fW, fH, null, IntPtr.Zero);

                    thumbimg.Save(Server.MapPath(_thumPath));
                    SavePicPath(_thumPath);

                }
            }
        }
        catch
        {
        }

Anytime it gets to GetThumbnailImage i get an error “Out of memory” please any correction or what am i doing wrong

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:21:43+00:00Added an answer on June 9, 2026 at 10:21 pm

    Change int values to (float or double). i think here fw/rw returning int value than float or double value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used the phonegap website to create an IPA file. Now I want to
I'm developing a multi-threaded ASP.NET 3.5 application, during working with some file, I'm getting
I have not used multi threading much for asp.net. I have a web application
I recently used the <<- operator to output a multi-line string, like this: <<-form
I want to count the lines of code in a multi-file Python project as
I've got good code, it used do work. But now I can't make it
I found a multi file upload script here. When I try to upload the
I used the below code to upload multiple files. Its working absolutely fine but
I'm trying to upload a multi-line text file to be GeoCoded by BING. 1,en-US,,16630
I've been trying to compile a multi-file project, but every time I try to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.