Results 1 to 2 of 2

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

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

    Default 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,556
    Answers
    3931
    Vote Rating
    1272
      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! Checkout the CODE tag!

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

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
  •