1

File Get from Database but not download in browser end,给出建议
Asp.net API controller Used, .net 3.0 used , EF core used

[HttpGet, Route("{requestId:int}")]
        public FileResult Download(int requestId)
        {
          LaborgDbContext laborgDbContext = new LaborgDbContext();
          try
          {
            FileUpload fileUpload = new FileUpload();
            fileUpload = laborgDbContext.FileUpload.Find(requestId);


            if (fileUpload != null)
            {

             FileContentResult file = File(fileUpload.FileByte, fileUpload.ContentType, fileUpload.DocumentName);
             return file;
            }
            else
            {
              return null;
            }
          }
          catch (Exception ex)
          {
            throw ex;
          }
        }
4

0 回答 0