locked
Saving Bitmap file on server RRS feed

  • Question

  • User2134858266 posted
    imageSource.Save(Server.MapPath("~/UserImages/" + txtUsernameA.Text + ".jpeg"));
    


    imageSource is a bitmap class variable and thee file doesnt get saved on the server?

    It gets stored on development server but not on the server

     

    I am getting this error : A generic error occurred in GDI+

    Thursday, November 29, 2012 8:02 PM

All replies

  • User-821857111 posted

    Most often, this error occurs because the user account (NETWORK SERVICE) doesn't have permission to write to the location you are trying to save the file at.  You need to apply WRITE permissions to the UserImages folder.

    Friday, November 30, 2012 2:37 AM
  • User-1716253493 posted

    Create folder called "UserImages" in Server

    Try also

    imageSource.Save(Server.MapPath("~/UserImages/") + @"\" + txtUsernameA.Text + ".jpeg");
    
    
    
    

    or create the dir if not exist before saving

           string spath = Server.MapPath("~/") + @"\UserImages";
            if (!System.IO.Directory.Exists(spath))
            {
                System.IO.Directory.CreateDirectory(spath);
            }



    Friday, November 30, 2012 2:58 AM
  • User-126879547 posted

    http://forums.asp.net/t/1280634.aspx/1

    http://stackoverflow.com/questions/1796873/how-to-save-web-c-sharp-bitmap-object-to-server-disk

    http://stackoverflow.com/questions/1347652/bitmap-save-in-net-is-saving-the-image-in-an-incorrect-format

    Friday, November 30, 2012 3:32 AM