View Full Version : File upload content not being sent

17 Mar 2014, 6:18 AM
I'm using a file upload field based on the one in the docs at http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.File and I will include the code below. When submitted a status 200 ensues with a round trip to the server indicating that Request.Files["file"] (in ASP.net MVC 2) is null, which is consistent with the following I'm seeing with Chrome dev tools: an attempted file upload, but with no content:

Content-Disposition: form-data; name="users"; filename="0_USER_INFO.xlsx"
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet


What am I doing wrong? Form panel code below. In addition to no form content being sent as indicated above, I've written the server side code to
return Content("{\"success\": false, \"msg\": \"postedFile == null\"}"); if the file is null, and this results in the
case Ext.form.action.Action.SERVER_INVALID: Ext.Msg.alert('Failure', action.result.msg); block being reached.

Thanks in advance.

Ext.define('Tools.view.users.Manager', {
extend: 'Ext.tab.Panel',
alias: 'widget.usermanager',

title: 'User Manager',
items: [{
title: 'Import',
items: [{
xtype: 'form',
width: 400,
bodyPadding: 10,
//frame: true,
renderTo: Ext.getBody(),
items: [{
xtype: 'filefield',
name: 'users',
fieldLabel: 'New Users',
labelWidth: 75,
msgTarget: 'side',
allowBlank: false,
anchor: '100%',
buttonText: 'From Excel'

buttons: [{
text: 'Upload',
handler: function () {
var form = this.up('form').getForm();
if (form.isValid()) {
url: '/User/Upload',
waitMsg: 'Uploading user data...',
success: function (form, action) {
Ext.Msg.alert('Success', action.result.msg);
failure: function (form, action) {
switch (action.failureType) {
case Ext.form.action.Action.CLIENT_INVALID:
Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
case Ext.form.action.Action.CONNECT_FAILURE:
Ext.Msg.alert('Failure', 'Ajax communication failed');
case Ext.form.action.Action.SERVER_INVALID:
Ext.Msg.alert('Failure', action.result.msg);