AJAX FILE UPLOAD

The examples below cannot be used with file uploads inside a form. To submit form with file uploads, see the example Submitting HTML Forms With AJAX.

To upload a file asynchronously, we need a cgi script. You have to move upload.cgi found in your download, to a directory where cgi scripts are allowed. For example; in most servers, there is a "cgi-bin" folder to do it. Note that it must be executable. If you work in your local, you need "PERL" installed. Please, read the instructions in the readme.txt file for that.

After that, you just need to call PLX.AjaxifyUpload method for the file inputs. You can control the upload with some parameters. Show parameters here:

Let's start with a basic example:

Example #1:


Select a file:   
% 0

* If you create more than one ajax uploads with the same options, you don't need to call AjaxifyUpload method for each. It may be used like PLX.AjaxifyUpload(["photo1", "photo2", "photo3"], {...})

PHP codes ahead are also used in following examples.

Example #2:

% 0
% 0

We have seen how simple it is. Let's add more option to the upload and increase the visuality:


 
% 0