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 430 posts 1809 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 169 posts 388 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 28 posts 149 karma points
    5 days ago
    Ł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