Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:02:46+00:00 2026-06-13T06:02:46+00:00

ExtJS Version : 4.1.0 Answered – See my response below… quite silly really I

  • 0

ExtJS Version : 4.1.0

Answered – See my response below… quite silly really

I have a simple form with a few fields, one of them being of the xtype fileuploadfield. I listen for the click event on my form’s save button in the Controller’s this.control method. When the click event occurs, I run a method saveForm, which looks like this:

saveForm: function(button) {
    /** Get the Window Object and retrieve the Form*/
    var currentWin = button.up('window'),
                form = currentWin.down('form');

    /** Get the Form Object */
    form = form.getForm();

    /** ...continued... */
}

At this point in my method, I can console.log the form object, inspect the object’s _fields and see my fileuploadfield and the path of the file I input in the field (i.e. C:\fakepath\somefile.png). I can also perform form.getField('upload-field-id'); to get the upload field element. The method form.hasUpload() returns TRUE.

The kicker is that when I call form.submit() and var_dump() the $_FILES array on my server, it is empty!

In the examples that I’ve seen of file uploading in ExtJS, the form submission happens via a handler function on the Save button in the view. As I like to keep logic for handling button presses in my controller, I’m hoping this is not my only option!

Any input would be greatly appreciated, thank you for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:02:47+00:00Added an answer on June 13, 2026 at 6:02 am

    I feel a bit silly, but the problem was pertaining to retrieving the form object from the button passed to my saveForm method.

    Corrected:

    In my ExtJS controller…

    saveForm: function(button)
    {
        var currentWindow = button.up('window');
    /** var form          = button.down('form').getForm(); **INCORRECT** */
        var form          = button.up('form').getForm(); /** this is correct */
    
            form.submit({
                url     : '/service/form/upload/format/json',
                waitMsg : 'Uploading....',
                success : function(form,o) {
                    alert(o.response.responseText);
                },
                failure: function(form, action)
                {
                    console.error('form, action', form,action);
                    alert('failure');
                }
            });
    }
    

    In my back-end (Zend), my controller action is simply:

    public function uploadAction()
    {
        var_dump($_FILES);
        this->view->success = false;
    }
    

    As expected, my Chrome Inspector outputs the following upon clicking the save button:

    Uncaught Ext.JSON.decode(): You're trying to decode an invalid JSON String:
     {"success":false}array(1) {
      ["file-upload-field"]=>
      array(5) {
        ["name"]=>
        string(29) "TestImage.jpg"
        ["type"]=>
        string(10) "image/jpeg"
        ["tmp_name"]=>
        string(14) "/tmp/php7XfeLD"
        ["error"]=>
        int(0)
        ["size"]=>
        int(89799)
      }
    }
    

    The server has successfully received the file upload!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a need to create an ExtJS component (version 2.3.0). The component
I'm using the Sencha ExtJS Framework in Version 4.05 and i have the following
I am using ExtJS version 3.0.0 and I really don't know why every time
I have requirement with the following functionality in EXTJS version 3.0 Is there any
ExtJS Class Handling is good to handle, but you have to pay it with
I am using ExtJS 4. I have created a tree panel as var treeStore
I have an ExtJS application that needs to display an html document within a
I'm using extjs mvc style to create a web application. I don't have any
We have RoR application and we are planning to make js interface(extjs or closure)
I've downloaded the latest version of ExtJS (4.0.7) and am deploying it on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.