3

How can I upload a file using ExtJS 3?

I watched this exmpale:

Upload File Example

But it seems like an Ext 4 example.

Anyone knows?

yanivsh
  • 293
  • 1
  • 5
  • 16
  • Got this example on extJS 3.3.1 [link](http://dev.sencha.com/deploy/ext-3.3.1/examples/form/file-upload.html), but it uses xtype:'fileuploadfield' that is not recongnized according to the API of ExtJS 3.3.1 that is shown here [link](http://dev.sencha.com/deploy/ext-3.x/docs/) – yanivsh Mar 04 '14 at 13:58
  • according to [docs](http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.form.BasicForm-cfg-fileUpload). There is an attribute `fileUpload` on `BasicForm` that may accomplish? – weeksdev Mar 04 '14 at 14:51
  • found it. it can be use also within FormPanel. all you need is to set some item of the FormPanel to the xtype:'textField' and configure it's inputType:'file'. That does the work. Thanks for the answer though. But the weird part is that this thing only work with xtype:'textField' and not with other xtypes such as 'button', 'textarea' etc. Do you know the reason perhaps? – yanivsh Mar 04 '14 at 15:02
  • I'm not positive why it would only be implemented on the textfield, that's a good question tho. – weeksdev Mar 04 '14 at 15:55

1 Answers1

3

There is no file upload component in ExtJS 3, but you can create one using this example : http://dev.sencha.com/deploy/ext-3.3.1/examples/form/file-upload.html

This example use a custom component for the file upload field (see http://dev.sencha.com/deploy/ext-3.3.1/examples/form/file-upload.js). Also don't forget to set fileUpload to true on your form.

Edit 4 years later : it seems that Sencha has removed the examples page for ExtJS 3, but you can still access a copy here : http://svn.geoext.org/ext/3.4.0/examples/form/file-upload.html

Christophe Le Besnerais
  • 3,895
  • 3
  • 24
  • 44
  • Thanks. Already solved it by this same example. Gonna accept your answer because of your good intention :) – yanivsh Feb 10 '15 at 18:09