public async Task <IHttpActionResult> PostAsync(string parentId = null, string mail = null, bool extract = false, CancellationToken cancellationToken = default(CancellationToken)) { int userId = ApiSecurity.CurrentUserId; var files = new List <FileItem>(); var parent = await FindFileAsync(parentId, cancellationToken); var parenti = parent == null ? default(int?) : parent.Id; var manager = new DriveManager(ApiSecurity.Manager, _services, ServerPaths.Map(ServerPaths.DriveFiles)); using (var content = await Request.Content.ReadAsFileStreamAsync(cancellationToken)) { files.Add(await manager.CreateFromStreamAsync(content.FileStream, parenti, userId, content.FileName, cancellationToken)); } return(Ok(ListResult.Create(files.Select(file => new FileStoreUploadResult { Name = file.Name, Link = new Uri(Request.RequestUri, Url.Route(PublicRootName, new RouteValueDictionary { { "userId", file.OwnerId }, { "path", file.PhysicalPath } })) .AbsoluteUri })))); }