Extjs文件上传使用json服务? [英] Extjs File upload using json service?
问题描述
我使用json服务(.net RIA服务)从Extjs将数据推送到服务器。目前我有要求将文件上传到服务器。我看到一些例子,使用表单提交到php文件。
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.
这可能通过json服务吗?或者是否需要创建一些服务器逻辑,我可以接受表单提交?
Is this possible through json service? or Is it necessery to create some server logic where i can accept form submits?
是否可以从客户端读取一些二进制数据,并将json数据推送到服务器?
Is it possible to read some binary data from client side and push as json data to server?
推荐答案
在Extjs中,使用正常的Ajax技术不会执行文件上传,即不使用XMLHttpRequests执行文件上传。相反,临时创建包含所有字段的隐藏元素,并将其目标集提交,以引用被插入到文档中的动态生成的隐藏,但在收集返回数据后被删除。
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.
请注意,文件上传数据包将以内容类型multipart / form和某些服务器技术发送
Be aware that file upload packets are sent with the content type multipart/form and some server technologies
检查: http://docs.sencha.com/ext-js/ 4-1 /#!/ api / Ext.form.Basic-method-hasUpload
这篇关于Extjs文件上传使用json服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!