public Stream GetStreamContents() { var dir = AjaxFileUpload.GetTempFolder(this._fileId); var filePath = Path.Combine(dir, this._fileName) + Constants.UploadTempFileExtension; AjaxFileUpload.CheckTempFilePath(filePath); return(File.OpenRead(filePath)); }
public void DeleteTemporaryData() { var dirInfo = new DirectoryInfo(AjaxFileUpload.GetTempFolder(this._fileId)); if (dirInfo.Exists) { dirInfo.Delete(true); } }
private static string GetTempFilePath(string fileId, string fileName) { var tempFolder = AjaxFileUpload.GetTempFolder(fileId); foreach (var invalidChar in Path.GetInvalidFileNameChars()) { fileName = fileName.Replace(invalidChar, '-'); } return(Path.Combine(tempFolder, fileName) + Constants.UploadTempFileExtension); }
private static string GetTempFilePath(string fileId, string fileName) { var tempFolder = AjaxFileUpload.GetTempFolder(fileId); var invalidChars = Path.GetInvalidFileNameChars() .Concat(new[] { '<', '>', '&', '"' }) .Distinct() .ToArray(); foreach (var invalidChar in invalidChars) { fileName = fileName.Replace(invalidChar, '-'); } return(Path.Combine(tempFolder, fileName) + Constants.UploadTempFileExtension); }
private static string GetTempFilePath(string fileId, string fileName) { var tempFolder = AjaxFileUpload.GetTempFolder(fileId); return(Path.Combine(tempFolder, fileName) + Constants.UploadTempFileExtension); }