1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    12
    Vote Rating
    0
    Unkind is on a distinguished road

      0  

    Default Unanswered: Problem with uploading file

    Unanswered: Problem with uploading file


    i have method that upload xls file<br>

    on 1 computer it's all ok, but on another i have error<br>

    Code:
    Uncaught You're trying to decode an invalid JSON String: <div id="header"><h1>Server Error</h1></div>
    <div id="content">
     <div class="content-container"><fieldset>
      <h2>500 - Internal server error.</h2>
      <h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
     </fieldset></div>
    </div>
    what i do not?

    p.s. i have another method? that upload images, this method work on all computers.
    realization like method for xls

    Code:
             if (param == 'addFile') {            var itemRs = this.getGrid().getSelectionModel().getSelection();
                var Sd = itemRs[0];
                var itemId = Sd.get('Id');
                if (form.isValid()) {
                    form.submit({
                        url: '/ServiceDemand/ServiceDemands/Upload',
                        params: {
                            itemId: itemId
                        },
                        waitMsg: TR.Config.WaitMsg,
                        success: function (form, o) {
                            win.close();
                            TR.Globals.showInfo(o.result.msg);
                            me.doRefreshFiles();
                        },
                        failure: function (form, o) {
                            TR.Globals.showError(o.result.msg);
                        }
                    });
                }
            }else if (param == 'import') {
                if (form.isValid()) {
                    form.submit({
                        url: '/ServiceDemand/ServiceDemands/Import',
                        waitMsg: TR.Config.WaitMsg,
                        success: function (form, o) {
                            win.close();
                            console.log(o.result.result);
                            TR.Globals.showInfo(o.result.result);
                            me.getGrid().store.load();
                            
                        }
                        ,failure: function (form, o) {
                            TR.Globals.showError(o.result.result);
                        }
                    });
                }
            }
    from controller i return
    Code:
    public ActionResult Upload()        {
               
                return Content("{success:true, result:\"Файл успешно добавлен.\"}");
            }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,644
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The form expects JSON in return, you are returning HTML.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

Thread Participants: 1