예제 #1
0
        private string GetSaveFilePath(string fileName, string midFilepath)
        {
            if (string.IsNullOrWhiteSpace(fileName) || string.IsNullOrWhiteSpace(FileGroup) ||
                string.IsNullOrWhiteSpace(midFilepath))
            {
                return("");
            }
            if (LocalPathList == null || LocalPathList.Count() == 0)
            {
                return("");
            }
            var diretory      = FilePathHelp.GetSubFolderName(fileName).Replace("/", "\\");
            var saveDirectory = String.Format(@"{0}{1}\{2}\{3}", LocalPathList[0], FileGroup, midFilepath, diretory);

            if (!Directory.Exists(saveDirectory))
            {
                Directory.CreateDirectory(saveDirectory);
            }
            var filePath = saveDirectory + fileName;

            return(filePath);
        }
예제 #2
0
        /// <summary>
        /// 保存视频文件
        /// </summary>
        /// <param name="fileIdentity"></param>
        /// <param name="destFileName"></param>
        public static void Save(string fileIdentity, string destFileName)
        {
            if (string.IsNullOrWhiteSpace(fileIdentity) || string.IsNullOrWhiteSpace(destFileName))
            {
                return;
            }
            var result = FileUploadManager.FileExists(fileIdentity);

            if (result)
            {
                var fileExtensionName = FileUploadManager.GetFileExtensionName(fileIdentity).ToUpper();
                var filePath          = FileUploadManager.GetFilePhysicalFullPath(fileIdentity);
                if (Image360FileExtensionName.Contains(fileExtensionName))
                {
                    if (destFileName.IndexOf(".") == -1)
                    {
                        destFileName = destFileName + "." + fileExtensionName;
                    }
                    var savePath = FilePathHelp.GetFileSavePath(fileExtensionName.ToLower());
                    savePath += FilePathHelp.GetSubFolderName(destFileName);
                    foreach (string localPath in LocalPathList)
                    {
                        string path = localPath + savePath.Replace("/", "\\");

                        //判断文件夹是否存在
                        if (!Directory.Exists(path))
                        {
                            Directory.CreateDirectory(path);
                        }
                        destFileName = path + destFileName;
                        //FLV文件重命名操作,不进行DFIS处理
                        File.Copy(filePath, destFileName, true);
                    }
                }
            }
        }