View Full Version : Submitting the form does not send a file

14 Feb 2013, 3:05 AM
I've been having this problem and it really drives me crazy.

The form I'm using does not send a file to the server. Even in the request sent and intercepted by Chrome JS debug, there are only two fields (IPENewProjectName and handle) present and there is no part that would indicate that the file is being sent at all.

The form creation:

var form = Ext.create('Ext.form.Panel', {
id: 'IPENewProjectForm',
frame: true,
fileUpload: true,

defaults: {
anchor: '100%',
allowBlank: false,
msgTarget: 'side',
labelWidth: 50

items: [{
xtype: 'textfield',
fieldLabel: 'Project name',
name: 'IPENewProjectName'
}, {
xtype: 'filefield',
fieldLabel: 'File',
name: 'IPENewProjectFile',
emptyText: 'Select a PDF file'
}, {
xtype: 'hiddenfield',
name: 'handle',
value: 'newProject'

buttons: [{
text: 'Create',
handler: submitHandler

Ext.create('Ext.Window', {
title: 'Create a new project',
width: 400,
id: 'IPENewProjectWindow',
x: 50,
y: 50,
plain: true,
headerPosition: 'top',
modal: true,
layout: 'fit',
items: [form]

Submit handler is defined like this:

submitHandler = function () {
var form = Ext.getCmp('IPENewProjectForm').getForm();
var window = Ext.getCmp('IPENewProjectWindow');

if (form.isValid()) {
url: 'UploadHandler.ashx',
method: 'POST',
waitMsg: 'Uploading your PDF.',
success: function (form, action) {
var responseObject = Ext.JSON.decode(action.response.responseText);
console.log('Success. " + responseObject.message);
failure: function (form, action) {
var responseObject = Ext.JSON.decode(action.response.responseText);
console.log('Failure. " + responseObject.message);


And the server side:

public void ProcessRequest(HttpContext context)
string serialized = "{\"success\": false, \"message\": \"Upload failed\"}";

int count = context.Request.Files.Count;

if (count > 0)
serialized = "{\"success\": true, \"message\": \"Upload successful\"}";

context.Response.ContentType = "text/html";

Thanks a lot for any help.

14 Feb 2013, 3:16 AM
Well, shame on me. It was an issue with naming the nested variable. Solved.

14 Feb 2013, 7:33 AM
Thank you for updating.