View Full Version : extjs form submit cant change method type to put???

5 Jun 2012, 1:34 AM
hello world :)

i facing disturbing problem i use filefield inside a form to upload my files
and its works fine...
today i tried add an other feature that lets user to update its files and change the form
method to put like this method:'PUT'
and its seems fine but when i try to update a file using chrome chrome dev tool
it fails
and gets error from server that the method is not allowed
when i look at the network tab in chrom dev tool i see the the method type remains post although i changed it

below is example from the code pleas help me!!

// params:{applicationId: this.appId, scriptName: this.getFileName()},
url: EE.Server.resourceUrl(invokeUrl)+'&'+ Ext.urlEncode(uploadParams),
method: 'PUT',
waitMsg: 'Updating your script...',
success: function(form, action) {
failure: function(form, action) {


5 Jun 2012, 4:50 AM
Form submissions accepts only 2 methods: 'get' and 'post'...


5 Jun 2012, 5:38 AM
well that's a big problem since its the only way to upload file using form
so does its mean we can never upload files using "PUT"?

before that i tried with Ext.Ajax.request
but thats not good i wasnt able to upload any file not withe post and with pu methods
also i have search the internet and non of the example to upload files using Ext.Ajax.request
worked for me i am using extjs 4.1

any alliterative?

5 Jun 2012, 6:33 AM
it's impossible to upload a file using an ajax request!
you can check if the filefield isn't empty then do record.save(), else do form submit()..
or place only the filefield in form, do record.save(), and then on success, if the filefield isn't
empty do form.submit()

xtype : 'textfield',
itemId : 'Name',
fieldLabel : 'Name',
width : 450
xtype : 'datefield',
itemId : 'Post_Stamp',
format : 'd.m.Y',
fieldLabel : 'Post Date',
width : 200

xtype: 'form',
itemId: 'fileform',
border: false,
xtype: 'filefield',
emptyText: 'Select a file..',
buttonText: 'Browse',
width: 450,
fieldLabel: 'Image',
name: 'image',

5 Jun 2012, 1:48 PM
soo like i said its impossible to upload file using ajax request
the only option is to use form and submit its content but forms have only two method 'POST' and
'GET' while i need to use 'PUT' hard one any ideas?

7 Jun 2012, 3:56 AM
in the end i use post instead it does the same job thanks for you help people