public static List <BO.o27Attachment> CopyTempFiles2Upload(string strSourceTempDir, string strTempGUID, string strDestUploadDir) { var lisO27 = new List <BO.o27Attachment>(); foreach (string file in System.IO.Directory.EnumerateFiles(strSourceTempDir, strTempGUID + "_*.infox", System.IO.SearchOption.TopDirectoryOnly)) { var info = System.IO.File.ReadAllText(file).Split("|"); var strGUID = BO.BAS.GetGuid(); var cO27 = new BO.o27Attachment() { o27ContentType = info[0], o27FileSize = BO.BAS.InInt(info[1]), o27Name = info[2], o27GUID = strGUID }; cO27.o27ArchiveFileName = strGUID + "_" + cO27.o27Name; cO27.o27ArchiveFolder = DateTime.Now.Year.ToString() + "\\" + DateTime.Now.Month.ToString(); if (!System.IO.Directory.Exists(strDestUploadDir + "\\" + cO27.o27ArchiveFolder)) { System.IO.Directory.CreateDirectory(strDestUploadDir + "\\" + cO27.o27ArchiveFolder); } cO27.FullPath = strDestUploadDir + "\\" + cO27.o27ArchiveFolder + "\\" + cO27.o27ArchiveFileName; System.IO.File.Copy(strSourceTempDir + "\\" + strTempGUID + "_" + cO27.o27Name, cO27.FullPath, true); lisO27.Add(cO27); } return(lisO27); }
public ActionResult FileDownloadNotFound(BO.o27Attachment c) { var fullPath = _app.TempFolder + "\\notfound.txt"; System.IO.File.WriteAllText(fullPath, string.Format("Soubor [{0}] na serveru [??????\\{1}] neexistuje!", c.o27Name, c.o27ArchiveFolder)); Response.Headers["Content-Disposition"] = string.Format("inline; filename={0}", "notfound.txt"); var fileContentResult = new FileContentResult(System.IO.File.ReadAllBytes(fullPath), "text/plain"); return(fileContentResult); }
public static List <BO.o27Attachment> GetUploadedFiles(string strSourceTempDir, string strTempGUID) { var lisO27 = new List <BO.o27Attachment>(); foreach (string file in System.IO.Directory.EnumerateFiles(strSourceTempDir, strTempGUID + "*.infox", System.IO.SearchOption.TopDirectoryOnly)) { var info = System.IO.File.ReadAllText(file).Split("|"); var cO27 = new BO.o27Attachment() { o27ContentType = info[0], o27FileSize = BO.BAS.InInt(info[1]), o27Name = info[2], o27GUID = strTempGUID }; cO27.o27ArchiveFileName = cO27.o27GUID + "_" + cO27.o27Name; cO27.FullPath = strSourceTempDir + "\\" + cO27.o27ArchiveFileName; lisO27.Add(cO27); } return(lisO27); }