Changeset 13827 for branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/JobController.cs
- Timestamp:
- 05/03/16 17:13:50 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/JobController.cs
r13754 r13827 310 310 } 311 311 } 312 //TODO Work in progress 313 /* public async Task<IActionResult> DownloadFile(int index, int filedex) 314 { 315 if (((HiveServiceLocatorWeb)(HiveServiceLocatorWeb.Instance)).CheckLogin()) 316 { 317 UploadedJobViewModel upper = new UploadedJobViewModel(); 318 fillUploadsPaths(upper, index); 319 320 HttpContext.Response.ContentType = "APPLICATION/OCTET-STREAM"; 321 String Header = "Attachment; Filename=" + upper.DisplayFilesPaths[filedex]; 322 HttpContext.Response.Headers.Add("Content-Disposition", Header); 323 System.IO.FileInfo Dfile = new System.IO.FileInfo(upper.FullFilesPaths[filedex]); 324 await HttpContext.Response.WriteAsync(Dfile.FullName); 325 //HttpContext.Response.End(); 326 327 var message = upper.DisplayFilesPaths[filedex] + " has been downloaded"; 328 329 upper.message = message; 330 ViewBag.Title = "Downloaded file"; 331 332 return View("Uploads", upper); 333 } 312 [HttpPost] 313 public IActionResult saveToFile(string fname) 314 { 315 if (init()) 316 { 317 weblog.getFileOpener(userId).SaveToFile(fname); 318 return RedirectToAction("Uploads", "Job"); 319 } 334 320 else 335 { 336 HiveServiceLocatorWeb.SetLoginErrorMessage(); 337 return RedirectToAction("Index", "Home"); 338 } 339 }*/ 321 { 322 return RedirectToAction("Index", "Home"); 323 } 324 } 325 326 public FileResult DownloadFile(int index, int filedex) 327 { 328 if (init()) 329 { 330 UploadedJobViewModel upper = new UploadedJobViewModel(); 331 fillUploadsPaths(upper, index); 332 333 System.IO.FileInfo Dfile = new System.IO.FileInfo(upper.FullFilesPaths[filedex]); 334 var fileName = Dfile.Name; 335 byte[] fileBytes = System.IO.File.ReadAllBytes(upper.FullFilesPaths[filedex]); 336 return File(fileBytes, "application/x-msdownload", fileName); 337 } 338 else 339 { 340 return null; 341 } 342 } 340 343 341 344 #endregion
Note: See TracChangeset
for help on using the changeset viewer.