X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=roojs-debug.js;h=55c819871815806aefc8d8ebf060ff6339463381;hp=ffc80b2da0b6a79eed1f2a7273dca57186aabff9;hb=d59b277dae414c8ed4dbc3522847f5f1b495081a;hpb=46068cd58eef522565ed1729d1171d5ff2aab292 diff --git a/roojs-debug.js b/roojs-debug.js index ffc80b2da0..55c8198718 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -11612,6 +11612,11 @@ Roo.extend(Roo.data.Connection, Roo.util.Observable, { url = url || form.action; var enctype = form.getAttribute("enctype"); + + if (o.formData) { + return this.doFormDataUpload(o,p,url); + } + if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){ return this.doFormUpload(o, p, url); } @@ -11789,7 +11794,40 @@ Roo.extend(Roo.data.Connection, Roo.util.Observable, { form.removeChild(hiddens[i]); } } + }, + // this is a 'formdata version???' + + + doFormDataUpload : function(o, ps, url) + { + var form = Roo.getDom(o.form); + form.enctype = form.encoding = 'multipart/form-data'; + var formData = o.formData === true ? new FormData(form) : o.formData; + + var cb = { + success: this.handleResponse, + failure: this.handleFailure, + scope: this, + argument: {options: o}, + timeout : o.timeout || this.timeout + }; + + if(typeof o.autoAbort == 'boolean'){ // options gets top priority + if(o.autoAbort){ + this.abort(); + } + }else if(this.autoAbort !== false){ + this.abort(); + } + + //Roo.lib.Ajax.defaultPostHeader = null; + Roo.lib.Ajax.useDefaultHeader = false; + this.transId = Roo.lib.Ajax.request( "POST", url, cb, o.formData, o); + Roo.lib.Ajax.useDefaultHeader = true; + + } + }); /* * Based on: @@ -16573,6 +16611,7 @@ Roo.apply(Roo.XComponent, { msg: msg, width:450, progress:true, + buttons : false, closable:false, modal: false @@ -47412,7 +47451,13 @@ Roo.extend(Roo.form.Form, Roo.form.BasicForm, { */ progressUrl : false, - + /** + * @cfg {boolean|FormData} formData - true to use new 'FormData' post, or set to a new FormData({dom form}) Object, if + * sending a formdata with extra parameters - eg uploaded elements. + */ + + formData : false, + /** * Opens a new {@link Roo.form.Column} container in the layout stack. If fields are passed after the config, the * fields are added and the column is closed. If no fields are passed the column remains open @@ -47968,7 +48013,8 @@ Roo.extend(Roo.form.Action.Submit, Roo.form.Action, { url:this.getUrl(!isPost), method: method, params:isPost ? this.getParams() : null, - isUpload: this.form.fileUpload + isUpload: this.form.fileUpload, + formData : this.form.formData })); this.uploadProgress();