public async Task <IActionResult> Upload([FromForm] UploadReuqest ur) { Directory.CreateDirectory("./uploads"); var fileId = Guid.NewGuid().ToString("N"); var filePath = $"./uploads/{fileId}"; await Task.Delay(TimeSpan.FromSeconds(4)); //throw new Exception(); var result = new RemoteBlob { MimeType = ur.File.ContentType, Name = ur.File.FileName, Size = Convert.ToInt32(ur.File.Length), Location = "http://cnn.com" }; using (var fs = System.IO.File.Create(filePath)) { //ur.File. await ur.File.CopyToAsync(fs); }; //return new BadRequestResult(); return(new OkObjectResult(result)); }
public Task <object> TestObject(RemoteBlob value) { return(Task.FromResult((object)value)); }