locked
How to upload image to webserver in Mono framework? RRS feed

  • Question

  • User1088674799 posted

    The code as below is OK at window server, but it throws error at linux server (mono + apache).

    System.Drawing.Image imgPhoto = System.Drawing.Image.FromStream(httpPostedFile.InputStream);

     the error message as below:

    System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter] at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] at System.Drawing.Image.InitFromStream (System.IO.Stream stream) [0x00000]

    at System.Drawing.Image.LoadFromStream (System.IO.Stream stream, Boolean keepAlive) [0x00000]
    at System.Drawing.Image.FromStream (System.IO.Stream stream) [0x00000]
    at CE.Platform.BLL.File.File.UploadImageByFile (Int32 thumbId, System.String fileName, FileTypes fileType, System.Web.HttpPostedFile httpPostedFile, CE.Platform.UploadErrs& uploadErr, System.Int32& fileSize) [0x00000]
    at CE.Platform.UI.Global.UploadImage.HttpPostBack () [0x00000]
    at CE.Platform.UI.Global.UploadImage.Page_Load (System.Object sender, System.EventArgs e) [0x00000]
    ......

    Tuesday, December 23, 2008 3:23 AM

Answers

  • User1439985827 posted

     Since ASP.NET is not officially supported on Mono / Apache, I am not surprised this doesn't work. GDI+ relies heavily on built-in Windows API (mainly the gdiplus.dll). So this very well be a bug with the Mono framework.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 23, 2008 3:26 PM

All replies

  • User1439985827 posted

     Since ASP.NET is not officially supported on Mono / Apache, I am not surprised this doesn't work. GDI+ relies heavily on built-in Windows API (mainly the gdiplus.dll). So this very well be a bug with the Mono framework.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 23, 2008 3:26 PM
  • User1088674799 posted

    I see, you make my mind clear. Thank you very much!

    Tuesday, December 23, 2008 8:16 PM