我有一个上传文件的方法,同时我正在更改名称和路径并将其副本保存到具有新名称的新路径中。
在数据库中,我可以看到新的文件名和路径,但是当我转到应该保存新文件的实际文件夹时,它不存在。如果有人能指出我如何解决这个问题,那就太好了:D
static string docx = @"../../TestFiles/Types.docx";
try
{
FileStream fileStream = new FileStream(docx, FileMode.Open, FileAccess.Read);
string filePath = fileStream.Name;
string fileName = Path.GetFileName(fileStream.Name);
docConverter.FileSubmit(6, filePath, fileName, 1, FILESTORELOCATION, 89);
fileStream.Close();
}
public void FileSubmit(int studentId, string rawStoragePath, string fileName, int uploadedByUserId, string storagePath, int assignmentElementsId)
{
Guid strGUID = Guid.NewGuid();
string FILESTORELOCATION = @"C:\TestFiles\";
storagePath = FILESTORELOCATION + strGUID + ".pdf";
DateTime uploadDate = DateTime.UtcNow;
stuSubSvc.UploadAssignment(studentId, strGUID,fileName, rawStoragePath, uploadDate, uploadedByUserId, storagePath, 0, assignmentElementsId);
}