|
|
|
@ -15,7 +15,7 @@ public class Ghre_AttachmentServices : BaseServices<Ghre_Attachment, Ghre_Attach |
|
|
|
|
public async Task<ServiceResult<FileUploadResult>> UploadVideoAsync(ChunkUpload upload) |
|
|
|
|
{ |
|
|
|
|
var file = upload.file; |
|
|
|
|
var path = $"{$"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}wwwroot{Path.DirectorySeparatorChar}files{Path.DirectorySeparatorChar}upload{Path.DirectorySeparatorChar}{upload.id}{Path.DirectorySeparatorChar}"}"; |
|
|
|
|
var path = $"{$"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}wwwroot{Path.DirectorySeparatorChar}files{Path.DirectorySeparatorChar}upload/{upload.masterId}/{Path.DirectorySeparatorChar}{upload.id}{Path.DirectorySeparatorChar}"}"; |
|
|
|
|
if (!Directory.Exists(path)) |
|
|
|
|
Directory.CreateDirectory(path); |
|
|
|
|
using (var stream = File.Create(path + $"{upload.chunkIndex}")) |
|
|
|
@ -32,11 +32,11 @@ public class Ghre_AttachmentServices : BaseServices<Ghre_Attachment, Ghre_Attach |
|
|
|
|
ext = upload.fileName.Substring(dotPos + 1); |
|
|
|
|
} |
|
|
|
|
var id = SnowFlakeSingle.Instance.NextId(); |
|
|
|
|
await FileMerge(upload.id, "."+ ext, id); |
|
|
|
|
await FileMerge(upload.id, "." + ext, id); |
|
|
|
|
using var _context = ContextFactory.CreateContext(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var filePath = $"/files/upload/{id}.{ext}"; |
|
|
|
|
|
|
|
|
|
var filePath = $"/files/upload/{upload.masterId}/{id}.{ext}"; |
|
|
|
|
var fileAttachment = new Ghre_Attachment(); |
|
|
|
|
fileAttachment.Id = SnowFlakeSingle.Instance.NextId(); |
|
|
|
|
fileAttachment.AttachmentNo = upload.file.FileName; |
|
|
|
|