Hi folks, I'm trying to get a workflow to download a file and not having much luck - has anyone had success with this and could help?
Currently, I have a file attribute that allows the client to select a media item, I can open this and using SendFileAsync can see it start to download... but then when "return WorkflowExecutionStatus.Completed" gets called the request gets interupted and the file gets cancelled.
Here's what I believe is the offending portion of code:
var filepath = new FileInfo(filename);
var response = _httpContextAccessor.HttpContext?.Response;
response.Clear();
response.Headers.Add("Content-Disposition", "attachment;filename=" + filepath.Name);
response.Headers.Add("Content-Length", filepath.Length.ToString());
response.Headers.Add("Content-Transfer-Encoding", "binary");
new FileExtensionContentTypeProvider().Mappings.TryGetValue(filepath.Extension, out var contenttype);
response.ContentType = contenttype ?? "application/octet-stream";
response.SendFileAsync(filepath.FullName);
response.CompleteAsync();
return WorkflowExecutionStatus.Completed;
workflow for file download
Hi folks, I'm trying to get a workflow to download a file and not having much luck - has anyone had success with this and could help?
Currently, I have a file attribute that allows the client to select a media item, I can open this and using SendFileAsync can see it start to download... but then when "return WorkflowExecutionStatus.Completed" gets called the request gets interupted and the file gets cancelled.
Here's what I believe is the offending portion of code:
Any help would be greatly appreciated, thank you.
Sorry this should be in Ubmraco Forms category - I can't seem to move it.
Bump
Hi, I'm trying to do a similar thing. Using your code I do get the very same result as you. Download is being interrupted.
Did you happen you find a solution?
Regards
is working on a reply...