FCExporter.setupDownload C# (CSharp) Method

setupDownload() private method

setup download headers and return ready flag in exportSettings
private setupDownload ( Hashtable exportParams ) : Hashtable
exportParams Hashtable Various export parameters
return Hashtable
    private Hashtable setupDownload(Hashtable exportParams)
    {
        
        //get export filename
        string exportFile = exportParams["exportfilename"].ToString();
        //get extension
        string ext = getExtension(exportParams["exportformat"].ToString());
        //get mime type
        string mime = getMime(exportParams["exportformat"].ToString());
        // get target window
        string target = exportParams["exporttargetwindow"].ToString().ToLower();

        // set content-type header 
        Response.ContentType = mime;

        // set content-disposition header 
        // when target is _self the type is 'attachment'
        // when target is other than self type is 'inline'
        // NOTE : you can comment this line in order to replace present window (_self) content with the image/PDF  
        Response.AddHeader("Content-Disposition", (target == "_self" ? "attachment" : "inline") + "; filename=\"" + exportFile + "." + ext + "\"");

        // return exportSetting array. 'Ready' key should be set to 'download'
        Hashtable retStatus = new Hashtable();
        retStatus["filepath"] = "";

        // set the output strem to Response stream as the file is going to be downloaded
        retStatus["outStream"] = Response.OutputStream;
        return retStatus;

    }