예제 #1
0
    /// <summary>
    /// Post the data as a multipart form
    /// postParameters with a value of type byte[] will be passed in the form as a file, and value of type string will be
    /// passed as a name/value pair.
    /// </summary>
    public static HttpWebResponse MultipartFormDataPost(string postUrl, string userAgent, Dictionary <string, object> postParameters)
    {
        string formDataBoundary = "-----------------------------28947758029299";
        string contentType      = "multipart/form-data; boundary=" + formDataBoundary;

        byte[] formData = WebHelpers.GetMultipartFormData(postParameters, formDataBoundary);
        return(WebHelpers.PostForm(postUrl, userAgent, contentType, formData));
    }