CopyTemporaryFile() public method

public CopyTemporaryFile ( string dbTemporaryFile, object entityId, FilesToDelete filesToDelete, string>.Func fileNameReplacer = null ) : CopyTemporaryFileResult
dbTemporaryFile string
entityId object
filesToDelete FilesToDelete
fileNameReplacer string>.Func
return CopyTemporaryFileResult
        private string CopyTemporaryFiles(ISaveRequestHandler handler, 
            UploadedFile[] oldFileList, UploadedFile[] newFileList, FilesToDelete filesToDelete)
        {
            foreach (var file in newFileList)
            {
                var filename = file.Filename.Trim();
                if (oldFileList.Any(x => String.Compare(x.Filename.Trim(), filename, StringComparison.OrdinalIgnoreCase) == 0))
                    continue;

                if (!filename.ToLowerInvariant().StartsWith("temporary/"))
                    throw new InvalidOperationException("For security reasons, only temporary files can be used in uploads!");

                var uploadHelper = new UploadHelper((subFolder.IsEmptyOrNull() ? "" : (subFolder + "/")) + fileNameFormat);
                var copyResult = uploadHelper.CopyTemporaryFile(filename, ((IIdRow)handler.Row).IdField[handler.Row].Value, filesToDelete);
                if (subFolder != null && !this.storeSubFolderInDB)
                    copyResult.DbFileName = copyResult.DbFileName.Substring(subFolder.Length + 1);

                file.Filename = copyResult.DbFileName;
            }

            return JSON.Stringify(newFileList);
        }
 private CopyTemporaryFileResult CopyTemporaryFile(ISaveRequestHandler handler)
 {
     var filename = (StringField)(handler.Row.FindField(this.fileNameField) ?? handler.Row.FindFieldByPropertyName(fileNameField));
     var newFilename = filename[handler.Row] = filename[handler.Row].TrimToNull();
     var uploadHelper = new UploadHelper((subFolder.IsEmptyOrNull() ? "" : (subFolder + "/")) + fileNameFormat);
     var copyResult = uploadHelper.CopyTemporaryFile(newFilename, ((IIdRow)handler.Row).IdField[handler.Row].Value, filesToDelete);
     if (subFolder != null && !this.storeSubFolderInDB)
         copyResult.DbFileName = copyResult.DbFileName.Substring(subFolder.Length + 1);
     return copyResult;
 }