Search code examples
javascriptpostextjsput

ExtJS file upload form method


How can I use file upload form with PUT method instead of POST? Here is my form code:

this.personEditForm = new Ext.FormPanel({
  xtype:"form",
  fileUpload:true,
  frame:true,
  autoScroll:true,
  layout:{
    type:"vbox",
    flex:"even"
  },
  items:[
    {
      xtype:'fileuploadfield',
      emptyText:'Выберите файл...',
      name:'avatar',
      width:300,
      fieldLabel:'Фото пользователя',
      buttonText:'Обзор'
    }
  buttons:[
    {
      text:'Сохранить',
      handler:function () {
        if (self.personEditForm.getForm().isValid()) {
          method = "PUT";
          url = PERSONS_URL + personID;
          self.personEditForm.getForm().submit({
            method:method,
            url:url,
            success:function (form, action) {}
          });
        }
      }
    }
  ]
 });

WHen I'm deleting file field, PUT method workd. WHat's wrong?


Solution

  • The docs specify using only GET or POST methods. http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.Basic-cfg-method