-
29 Sep 2011 6:40 AM #1
Unanswered: FileUploadField in FieldContainer doesn't use extUpload
Unanswered: FileUploadField in FieldContainer doesn't use extUpload
Hi All,
I'm working on a image tool. It uses the google image api, the flickr search api and it should use the FileUploadField.
It is wrapped in a FieldContainer, so the user can choose what type image to post. And i can implement it in different forms, with a xtype field.
Its working great with the google image api and the flickr api.
However now i want the FileUploadField in it.
How do i tell the form it should use a file upload?
I tried to give the fieldcontainer a function 'isFileUpload' which returns true if its an local image instead of a selection from one of the api's. However its still an XHTTPRequest instead of the post with extUpload: true.
-
29 Sep 2011 9:26 AM #2
You need to call the upload method on the Ext.data.Connection object that submits the form. It might be easiest to create a form dynamically, add your file upload field to it, and then submit the form.
I wrote a file upload component for ExtJS that might help you - you may be able to build what you need using it:
http://m4dc4p.github.com/uploader/
-
29 Sep 2011 11:43 PM #3
I took an other good look at my code trying to fire out why it wasn't creating a multipart form.
I found out that I don't submit a form, I save a record.
Is there a way to trigger the file upload when saving the record?
here's a snippet of code :
Code:saveAction: function() { var me = this, form = me.getForm(), // get the basic form record = form.getRecord(); // get the underlying model instance if (form.isValid()) { form.updateRecord(record); record.save({ // save the record to the server success: function(newsitem) { Ext.Msg.alert('Succes', 'Saved successfully'); }, failure: function(newsitem, action) { Ext.Msg.alert('Error', action.error); } }); } else { // display error alert if the data is invalid Ext.Msg.alert('Error', 'Please enter all required fields'); } },
-
30 Sep 2011 7:14 AM #4
-
10 Oct 2011 12:58 AM #5
I've searched the api docs, and the forum. However I can't find how to do this.
I found an other topic with the almost same question, and the answer to that was that it wasn't possible.
http://www.sencha.com/forum/showthre...C-architecture


Reply With Quote