Ejemplo n.º 1
0
        public static PhysicalFileFromTemp Save(int operatorID, TempUploadFile tempUploadFile)
        {
            if (operatorID <= 0)
            {
                Context.ThrowError(new NotLoginError());
                return(null);
            }

            if (tempUploadFile == null)
            {
                return(null);
            }

            PhysicalFileFromTemp file = FileDao.Instance.SaveFile(operatorID, tempUploadFile.TempUploadFileID);

            string tempUploadFilePath = IOUtil.JoinPath(Globals.GetPath(SystemDirecotry.Temp_Upload), file.TempUploadServerFileName);
            string targetFilePath     = IOUtil.JoinPath(Globals.GetPath(SystemDirecotry.Upload_File), file.ServerFilePath);

            string targetDirectory = Path.GetDirectoryName(targetFilePath);

            try
            {
                if (File.Exists(targetFilePath))
                {
                    File.Delete(tempUploadFilePath);
                }

                else
                {
                    if (Directory.Exists(targetDirectory) == false)
                    {
                        Directory.CreateDirectory(targetDirectory);
                    }

                    File.Move(tempUploadFilePath, targetFilePath);
                }
            }
            catch { }

            return(file);
        }
Ejemplo n.º 2
0
        public PhysicalFileFromTemp Save()
        {
            PhysicalFileFromTemp file = FileManager.Save(this.UserID, this);

            return(file);
        }