예제 #1
0
        public static string Save(string fileName, string container, byte[] fileBytes)
        {
            var filePath = string.Format("{0}\\{1}\\{2}", ServerUtil.StoragePath(), container, fileName);

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }

            File.WriteAllBytes(filePath, fileBytes);

            return(string.Format(".//{0}\\{1}", container, fileName));
        }
예제 #2
0
        public static byte[] GetFile(string fileName, string container)
        {
            var filePath = string.Format("{0}\\{1}\\{2}", ServerUtil.StoragePath(), container, fileName);

            try
            {
                return(File.ReadAllBytes(filePath));
            }
            catch (Exception ex)
            {
                ServerUtil.LogException(ex);
                throw ex;
            }
        }
예제 #3
0
        public static bool Delete(string fileName, string container)
        {
            var filePath = string.Format("{0}\\{1}\\{2}", ServerUtil.StoragePath(), container, fileName);

            try
            {
                File.Delete(filePath);
                return(true);
            }
            catch (Exception e)
            {
                ServerUtil.LogException(e);
                return(false);
            }
        }