Upload files with jqxFileUpload to PHP service

In this help topic you will learn how to use the jqxFileUpload control using a PHP page hosted on a XAMPP local server.

1. Download and install XAMPP

In this tutorial, we will be using XAMPP for Windows 5.5.27. You can get it from here: https://www.apachefriends.org/download.html.
For more information on how to properly install and configure XAMPP please refer to XAMPP documentation and FAQ, links for which are available on the download page.

2. Launch XAMPP and start the apache web Server

  1. In your XAMPP install directory (let's assume c:\xampp\) you should see xampp-control.exe:
    When you run it you should see something like this:

  2. Select Start for the Apache server. If it started it should look like this:
  3. Note: On the screenshot you can see that we are using port 2080. The default port is 80, if you want to change it you can do so by pressing config -> Apache (httpd.conf), and editing the "Listen" line.

3. Create your php server file

By default the location your web server is storing its files is /xampp/htdocs
Create a new PHP file in that folder and call it imageUpload.php Here is an example for the PHP file contents:

This file will be responsible for the post requests sent by our client page. It is configured to accept image mime types, and only with extensions .jpg, .jpeg, .bmp, .png and .gif. It works for single and multiple uploads since jqxFileUpload sends the files one by one.
Note: Make sure to create the uploads folder inside your htdocs folder, or to change the destination for the uploads to an existing folder on your computer.

4. Creare your HTML page using jqxFileUpload widget.

Create two folders in htdocs folder - scripts and jqwidgets. Include in them all (or only the necessary) jQWidgets files - the scripts (including jqxcore.js and the specific widget files jqxbuttons.js and jqxFileUpload.js) in jqwidgets and the stylesheets (jqx.base.css and any themes and associated images) in jqwidgets/styles. Remember to include a version of jQuery in scripts folder, too.

Create a new HTML file in the htdocs folder as the php script, let's call it fileUploadDemo.html

The file should look like this:

Note: the uploadUrl parameter is pointing to the php file we've created earlier.

5. Test your web page.

Open up your web browser and browse to http://localhost/fileUploadDemo.html (assuming you didn't configure another port and used the given filenames).