/// <summary> /// Gets the name of the local file which will be combined with the root path to create an absolute file name where the /// contents of the current MIME body part will be stored. /// </summary> /// <param name="headers">The headers for the current MIME body part.</param> /// <returns> /// A relative filename with no path component. /// </returns> public override string GetLocalFileName(HttpContentHeaders headers) { string id = Guid.NewGuid( ).ToString(@"N"); string fileName = headers.ContentDisposition.FileName.Trim('"'); string localFileName = FileManagerService.GetFilenameFromFileId(id); RemoteToLocalFileNameMap.Add(fileName, localFileName); return(localFileName); }
/// <summary> /// Inserts the file to the database. /// </summary> /// <param name="fileUploadId">The file upload identifier that was created by the file manager service.</param> /// <remarks>The file upload ID is used as the primary key for the table that holds the file for the import.</remarks> public string InsertFileToRepository(string fileUploadId) { string token; // Write the data to the stream string documentFilename = FileManagerService.GetFilenameFromFileId(fileUploadId); using (var source = new FileStream(documentFilename, FileMode.Open, FileAccess.Read, FileShare.Read)) { token = FileRepositoryHelper.AddTemporaryFile(source); } File.Delete(documentFilename); return(token); }