Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I'm working on a solution with an AngularJS frontend, which is comunicating over ajax calls with a web server. On the webserver are running some Web API 2 controllers useing the Entity Framework to store data on a sql server. This is working fine except the file upload. I want to use the angular-file-upload to send the image to the webserver and store it on the sql server. But i dont know how to catch the data on the server side, because i cant use the Request Method in my Web API 2 Controller.

My Web API Controller looks like this:

    [ResponseType(typeof(Artikel))]
    public async Task<IHttpActionResult> PostArtikel(Artikel artikel)
    {
        if (!ModelState.IsValid)
        {
            return BadRequest(ModelState);
        }

        db.Artikels.Add(artikel);
        await db.SaveChangesAsync();

        return CreatedAtRoute("DefaultApi", new { id = artikel.Id }, artikel);

    }

"Artikel" Object

public partial class Artikel
{
    public Artikel()
    {
        this.BestellungArtikels = new HashSet<BestellungArtikel>();
    }

    public int Id { get; set; }
    public string Name { get; set; }
    public byte[] Bild { get; set; }
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.