Chapters
Other Resources
- Jaxer FAQ
Still have questions? - Jaxer API Docs
Browse through our online API documentation.
| Jaxer Update Available. |
Jaxer 1.0 RC B is now available at the Download Page. This release has many new features and updated APIs. Jaxer 1.0 RC B API docs: Available inside Aptana Studio after you run the update. Additional Info: Jaxer 0.9 Beta to Jaxer 1.0 RC Migration Guide. |
Uploading files to Jaxer from a web form is a relatively straightforward process. All you need is a form to present to the user, which contains an input element of type upload, and an html page to receive the submitted form.
This example upload form simply allows you to select up to 2 files for upload from the local filesystem. Pressing 'upload' posts the contents of that form to an HTML page containing the javascript shown later.
The form will look like the following when viewed in a browser. Pressing the browse button will present you with a file selection dialog, or you can type the path into the input box directly.
To receive the data from the form when submitted we put some jaxer code into the page the form will be submitted to.
The data posted by the form is available within the Jaxer.request object.
For the purposes of this example we are specifically interested in the Jaxer.request.files array which contains an array of Jaxer.Request.FileInfo objects, one for each file posted with the form.
The Jaxer.Request.FileInfo object contains some useful properties describing the file, such as fileName, contentType, etc.Uploading 2 files from my filesystem from the form in this example would return a page of output like below. We have uploaded the file to same location as the submission.html file used as the form action in the originating HTML.
Saved to C:\aptana\JaxerDev\public\work\bar.txt original filename : bar.txt temp filename : C:\aptana\JaxerDev\tmp\tmp contentType : text/plain size : 15754 Saved to : C:\aptana\JaxerDev\public\work\foo.txt original filename : foo.txt temp filename : C:\aptana\JaxerDev\tmp\tmp-1 contentType : text/plain size : 816
API docs for the FileInfo object and the Jaxer.Request object are available online.