Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

how to upload large data by chunks using WebApi 2

$
0
0

hello,

i'm using angularJs plugin to upload .mp3 files.

Demo: http://nervgh.github.io/pages/angular-file-upload/examples/simple/

plugin : https://github.com/nervgh/angular-file-upload

the above plugin sending chunk data for large file.

but i really don't have idea to get chunk data and save as file.

here is my code:

        public HttpResponseMessage Upload()
        {
            HttpResponseMessage response = new HttpResponseMessage();
            var httpRequest = HttpContext.Current.Request;
            if (httpRequest.Files.Count > 0)
            {
                foreach (string file in httpRequest.Files)
                {
                    var postedFile = httpRequest.Files[file];
                    var filePath = HttpContext.Current.Server.MapPath("~/content/tracks/" + postedFile.FileName);
                    postedFile.SaveAs(filePath);
                }
            }
            return response;
        }

Please help.

Appreciate for quick and best response.


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images