1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    21
    Vote Rating
    0
    Supriya Kale is on a distinguished road

      0  

    Default Unanswered: Downloading image/text file using 'iframe' and 'Ext.core.DomHelper'

    Unanswered: Downloading image/text file using 'iframe' and 'Ext.core.DomHelper'


    am using Extjs - 4.1.0 and I want to prompt download window. I used 'iframe'. The window gets displayed only when the file being posted is zip/mp3 but when the file being posted is text/image file, the window doesn't appear. Is there some property to be set to enable download window for text/image/different files? Please find my code below.

    Code:
    var record = item.findParentByType('itemcontextmenu').record;
                Ext.Ajax.request({
                    url : ORT.Configuration.DOWNLOAD_GRAPHICS_URI+"&graphics="+record.get('id'),
                    success: function (response, opt) {
                    
                        result = Ext.decode(response.responseText);
                        try {Ext.destroy(Ext.get('graphicsDownloadIframe'));}catch(e) {}
                        Ext.core.DomHelper.append(document.body, {
                            tag: 'iframe',
                            id:'graphicsDownloadIframe',
                            css: 'display:none;visibility:hidden;height:0px;',
                            src: result.fileName,
                            frameBorder: 0,
                            width: 0,
                            height: 0
                        });
                    }    
                });
    Thanks in advance.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    Answers
    3161
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Sounds like the browser is trying to display the image doesn't it? Browser by default will display images. Take a url of an image and put it as the url and see what the browser does.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.