You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.6 KiB
65 lines
1.6 KiB
using CounsellorBL;
|
|
using DefenseWeb.Models;
|
|
using OT.COM.LogisticsUtil;
|
|
using OT.COM.SignalerMessage;
|
|
using SoldierData;
|
|
using SoldierData.syserp;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
|
|
namespace DefenseWeb.Controllers
|
|
{
|
|
public class FileController : Controller
|
|
{
|
|
// http://localhost:2180/File/DirectDownload?FilePath=Uploads/a.xls
|
|
public ActionResult DirectDownload(string FilePath)
|
|
{
|
|
ActionResult ar = null;
|
|
string sMsg = null;
|
|
|
|
try
|
|
{
|
|
do
|
|
{
|
|
if (FilePath == null || FilePath.Trim().Length == 0)
|
|
{
|
|
sMsg = "NO PATH";
|
|
break;
|
|
}
|
|
|
|
string sTestPath = Server.MapPath("~/" + FilePath);
|
|
|
|
if (System.IO.File.Exists(sTestPath) == false)
|
|
{
|
|
sMsg = "FILE NOT EXIST";
|
|
break;
|
|
}
|
|
|
|
string[] saPath = FilePath.Split("\\/".ToCharArray());
|
|
|
|
ar = File(sTestPath, System.Net.Mime.MediaTypeNames.Application.Octet, saPath[saPath.Length - 1]);
|
|
}
|
|
while (false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sMsg = new Util().GetLastExceptionMsg(ex);
|
|
}
|
|
|
|
if (sMsg != null)
|
|
{
|
|
ar = Content(sMsg);
|
|
}
|
|
|
|
return ar;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|