0

I've looked at a few examples, but they were all written when the project was in beta and I'm unable to find a clear way to do this.

the file uploads to the server but I can't seem to access any other form data in my controller.

Does anyone know of an example or can offer some code that works with ASP.NET RC webapi that can shed some light?

4

1 回答 1

0
var formData = new FormData($('form')[0]);
formData.append('SomeId', $('#id').attr('value'));

然后...在控制器中

HttpContent idPart = parts.FirstDispositionNameOrDefault("SomeId");

if (idPart == null)
{

    throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest));

}
int id = int.Parse(idPart.ReadAsStringAsync().Result);
于 2012-06-16T16:35:24.750 回答