locked
ReadFormData vs multipart/form-data RRS feed

  • Question

  • Hi,

    (MSRS 1.0)

    DsspHttpUtilities.ReadFormData does not appear to play nice with multipart input.  Uploading an image with this html form produces junk in the resulting collection:

    <form id="oForm" action="" enctype="multipart/form-data" method="post">
                          <input type="file" name="inputTarget" size="40" />
                          <input type="submit" value="Send" />

    cheers,
    R
    Tuesday, April 17, 2007 6:00 PM

Answers

  • You are right, MIME multipart is not supported. It has been on the list for some time but got delayed because none of the existing MIME parsers already present in the .Net Framework are exposed in a reusable manner.

     

    I will add it back on the list but in the mean time, if you don't mind, you can get to it yourself by reading the request stream and parse it directly. Use ReadRequestToStream to read the request to a memory stream and parse it directly out of there. It is not great for large MIME body enties but will work fine for most common cases.

     

    Henrik

    Wednesday, April 18, 2007 5:15 AM

All replies

  • You are right, MIME multipart is not supported. It has been on the list for some time but got delayed because none of the existing MIME parsers already present in the .Net Framework are exposed in a reusable manner.

     

    I will add it back on the list but in the mean time, if you don't mind, you can get to it yourself by reading the request stream and parse it directly. Use ReadRequestToStream to read the request to a memory stream and parse it directly out of there. It is not great for large MIME body enties but will work fine for most common cases.

     

    Henrik

    Wednesday, April 18, 2007 5:15 AM
  • Thanks Henrik,

    Is there a reason why I should use ReadRequestToStream over directly accessing post.Body.Context.Request.InputStream?

    cheers,
    R
    Wednesday, April 18, 2007 3:57 PM