Jom
Jom

Reputation: 1897

Extjs File upload using json service?

I am using json service(.net RIA service) to push data to server from Extjs. Currently I have a requirement to upload document to server. I saw some examples using form submit to php files.

Is this possible through json service? or Is it necessery to create some server logic where i can accept form submits?

Is it possible to read some binary data from client side and push as json data to server?

Upvotes: 1

Views: 4588

Answers (2)

Rency
Rency

Reputation: 404

In Extjs, File uploads are not performed using normal 'Ajax' techniques, that is they are not performed using XMLHttpRequests. Instead a hidden element containing all the fields is created temporarily and submitted with its target set to refer to a dynamically generated, hidden which is inserted into the document but removed after the return data has been gathered.

Be aware that file upload packets are sent with the content type multipart/form and some server technologies

check : http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.Basic-method-hasUpload

Upvotes: 1

Vyacheslav Voronchuk
Vyacheslav Voronchuk

Reputation: 2463

Yes it's possible. You should use FileReader to get binary base64 encoded content (FileReader.readAsDataURL(Blob|File)), which you can transfer with JSON.

More insights here: http://www.html5rocks.com/en/tutorials/file/dndfiles/

Upvotes: 1

Related Questions