Esempio n. 1
0
        public ActionResult CommonFileDownload(HttpFile fileModel)
        {
            try
            {
                HttpFile downFile = HttpFileRepository.SelFile(fileModel);

                if (downFile == null || downFile.FileOID == null)
                {
                    throw new Exception("잘못된 호출입니다.");
                }

                System.IO.Stream fileStream = SemsValut.GetFileStream(downFile);
                //new ActionLog(downFile, eActionType.DOWNLOAD, null).InsertData();

                if (Request.Browser.Browser == "IE" || Request.Browser.Browser == "InternetExplorer")
                {
                    return(File(fileStream, MediaTypeNames.Application.Octet, HttpUtility.UrlEncode(downFile.OrgNm, System.Text.Encoding.UTF8)));
                }
                else
                {
                    return(File(fileStream, MediaTypeNames.Application.Octet, downFile.OrgNm));
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message.Replace("'", "");
                return(Content("<script language='javascript' type='text/javascript'>alert('" + message + "');history.back();</script>"));
            }
        }