everybody. i'm using web api. i have a problem when i want download file from byte[] in binary in sql server. in asp.net mvc i using follow

        public ActionResult download(int dfile)
            filemanagerDataContext db = new filemanagerDataContext();
            tblfile _file = db.tblfiles.FirstOrDefault(x => x.id == dfile);
           // if (_file == null) return false;//không tồn tại false
            Byte[] bytes = _file.data.ToArray();
            string fileName = _file.text;
            // string fileName = "aa";
            return File(bytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);

however, i want to download this file in web api. can i help me.

Related posts

Recent Viewed