O'Reilly logo

Ext JS 4 Web Application Development Cookbook by Stuart Ashworth, Andrew Duncan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Uploading files to the server

Uploading files is very straightforward with Ext JS 4. This recipe will demonstrate how to create a basic file upload form and send the data to your server:

Uploading files to the server

Getting Ready

This recipe requires the use of a web server for accepting the uploaded file. A PHP file is provided to handle the file upload; however, you can integrate this Ext JS code with any server-side technology you wish.

How to do it...

  1. Create a simple form panel.
    Ext.create('Ext.form.Panel', {
        title: 'Document Upload',
        width: 400,
        bodyPadding: 10,
        renderTo: Ext.getBody(),
        style: 'margin: 50px',
        items: [],
        buttons: []
    });
  2. In the panel's items collection add a file ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required