Results 1 to 2 of 2

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    21
    Vote Rating
    1
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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 in print!

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •