Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bo Jacobsen 590 posts 2366 karma points
    Sep 05, 2016 @ 09:24
    Bo Jacobsen
    0

    Forms Workflow Download a file

    Using Umbraco version 7.5.2; Umbraco Forms: 4.3.2

    Hello everyone.

    I want to make a workflow where i force the user to download a file. But if i use response.TransmitFile(xxx), then it stops the form process and never gets completed. (but the file is bein downloaded).

    I made a workflow where the user can select a file from the media library. And that returns a url. (So i convert it to a File.)

    public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
    {
        if (!string.IsNullOrEmpty(ChoosenFile))
        {
            var filePathAndName = HostingEnvironment.MapPath("~" + ChoosenFile);
            if (!string.IsNullOrEmpty(filePathAndName))
            {
                var file = new FileInfo(filePathAndName);
                var response = HttpContext.Current.Response;
                response.AppendHeader("Content-Disposition", "attachment; filename=" + file.Name);
                response.AppendHeader("Content-Length", file.Length.ToString());
                response.ContentType = ContentHelper.ReturnExtension(file.Extension.ToLower());
                response.TransmitFile(file.FullName);
                response.End();
    
                return WorkflowExecutionStatus.Completed;
            }
        }
    
        return WorkflowExecutionStatus.Failed;
    }
    

    It downloads the file, but stop the form progress.. I hope someone knows what to do ;)

  • Kristoffer Eriksen 185 posts 465 karma points
    Sep 12, 2016 @ 09:32
    Kristoffer Eriksen
    0

    Does anyone have an idea or solution to this issue?

    The file gets downloaded, but the workflow doesn't get finished.

  • Łukasz Koruba 30 posts 151 karma points
    Feb 22, 2021 @ 16:38
    Łukasz Koruba
    0

    Does anyone has solution for not completing the workflow?

Please Sign in or register to post replies

Write your reply to:

Draft