Results 1 to 2 of 2

Thread: Downloading file from database

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    12

    Default Downloading file from database

    I have error 'You're trying to decode an invalid JSON String: PNG ' when calling method: [nsIDOMEventListener::handleEvent]

    What is it? Don`t find any answer(

    I have image button in grid
    Code:
         xtype: 'actioncolumn',
                        width: 50,
                        items: [{
                            icon: 'Content/Resources/images/btnSave.gif', 
                            tooltip: 'Edit',
                            handler: function (grid, rowIndex, colIndex) {
                                var rec = grid.getStore().getAt(rowIndex);
                                var id = rec.get('Id');
    
                                Ext.Ajax.jget({
                                    url: 'Utilization/UtilizationFile/Download',
                                    params: { id: id },
                                    scope: this
                                });
                            }
                        },
    and mvc controller

    Code:
            public ActionResult Download(int id) 
            {
    
                var file = UtilizationFiles.GetUtilizationFileById(id);
    
                return File(file.Data, file.ContentType);
            }
    What i do not?
    I beginner in ext

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    Ext.Ajax isn't going to be able to allow a user to download a file if that's what you are trying to do.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

Posting Permissions

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