Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. error while resizing uploaded image

error while resizing uploaded image

Scheduled Pinned Locked Moved C#
graphicsquestionsysadminhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    uglyeyes
    wrote on last edited by
    #1

    Hi, when uploading a image to a server, I get error saying directory not found. I am guessing its because its trying to find a path of users computer path in server and failing. in my localhost this works fine. how can i modify below code so that below line System.Drawing.Image.FromFile(System.IO.Path.GetFullPath(flUpload.PostedFile.FileName)) maps to server. is there anyway i can get it working before actually uploading the original image to the server? thank you

    using (System.Drawing.Image Img = System.Drawing.Image.FromFile(System.IO.Path.GetFullPath(flUpload.PostedFile.FileName)))
    {
    Size ThumbNailSize = NewImageSize(Img.Height, Img.Width, 100);
    Size ImageSize = NewImageSize(Img.Height, Img.Width, 500);

                            using (System.Drawing.Image ImgThnail = new Bitmap(Img, ThumbNailSize.Width, ThumbNailSize.Height))
                            {
                                ImgThnail.Save(ImageThumbPath, Img.RawFormat);
                                ImgThnail.Dispose();
                            }
                            using (System.Drawing.Image Img1 = new Bitmap(Img, ImageSize.Width, ImageSize.Height))
                            {
                                Img1.Save(ImagePath, Img.RawFormat);
                                Img1.Dispose();
                            }
                            Img.Dispose();
                        }
    
    J 1 Reply Last reply
    0
    • U uglyeyes

      Hi, when uploading a image to a server, I get error saying directory not found. I am guessing its because its trying to find a path of users computer path in server and failing. in my localhost this works fine. how can i modify below code so that below line System.Drawing.Image.FromFile(System.IO.Path.GetFullPath(flUpload.PostedFile.FileName)) maps to server. is there anyway i can get it working before actually uploading the original image to the server? thank you

      using (System.Drawing.Image Img = System.Drawing.Image.FromFile(System.IO.Path.GetFullPath(flUpload.PostedFile.FileName)))
      {
      Size ThumbNailSize = NewImageSize(Img.Height, Img.Width, 100);
      Size ImageSize = NewImageSize(Img.Height, Img.Width, 500);

                              using (System.Drawing.Image ImgThnail = new Bitmap(Img, ThumbNailSize.Width, ThumbNailSize.Height))
                              {
                                  ImgThnail.Save(ImageThumbPath, Img.RawFormat);
                                  ImgThnail.Dispose();
                              }
                              using (System.Drawing.Image Img1 = new Bitmap(Img, ImageSize.Width, ImageSize.Height))
                              {
                                  Img1.Save(ImagePath, Img.RawFormat);
                                  Img1.Dispose();
                              }
                              Img.Dispose();
                          }
      
      J Offline
      J Offline
      J a a n s
      wrote on last edited by
      #2

      Check this link : http://forums.asp.net/t/1079883.aspx[^] Note: Please post the questions related to asp.net in the correct forum.

      "Never put off until run time what you can do at compile time." - David Gries, in "Compiler Construction for Digital Computers", circa 1969.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups