Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


File Uploader

The File Uploader extension provides a means to upload files to file server.

Author: Jerome Carty

Tested On

  • BlackBerry Torch 9810 v7.0.0.439
  • BlackBerry Bold 9900 v7.0.0.353
  • BlackBerry Bold 9650 v6.0.0.546
  • BlackBerry Curve 9300 v5.0.0.716

Requires BlackBerry WebWorks SDK for Smartphones v2.0 or higher

Have a problem with this extension? Log an Issue or contact the Author

How To Configure The Extension For Use

  1. Locate your BlackBerry WebWorks SDK for Smartphone extensions directory using your File Explorer. Default path is C:\Program Files\Research In Motion\BlackBerry WebWorks Packager\ext

  2. Create a new webworks.io.FileUploader directory in the ext directory

  3. Download the source from this repository and unzip it to a location on your computer

  4. Using File Explorer browse to this extension's downloaded source code Smartphone\FileUploader

  5. Copy the library.xml file from the downloaded Smartphone\FileUploader directory to your new ext\webworks.io.FileUploader directory

  6. Copy the downloaded Smartphone\FileUploader\src\webworks directory to your new ext\webworks.io.FileUploader\webworks directory

NOTE: Be sure to back-up this ext\webworks.io.FileUploader directory in your WebWorks SDK extensions directory before performing a WebWorks SDK upgrade. Simply copy it back into the ext directory after you have completed your SDK upgrade.

Required Feature ID

Whenever you use the below feature id in any of your WebWorks applications this extension will be loaded for use.

<feature id="webworks.io.FileUploader" />


Code Example

function foo()
    var options = {
		url: 'http://www.youruploadurl.com/path',
		file: 'file:///' + file,
		fileKey: 'myFile',
		mimeType: 'image/jpg',
		timeout: 60000, // in milliseconds default is 30000
		params: {
			custom1: 'test'
		headers: {
			'Authorization', 'AUTH_HERE'
		success: function(data) {
		error: function(e, code) {
			alert(e + " " + code);

Server Code Example

This is a simple ASP.NET example to accept the file upload.

            string FolderPath = HttpContext.Current.Server.MapPath("~/") + "//upload";

            if (!Directory.Exists(FolderPath))
            HttpPostedFile file = context.Request.Files["myFile"];
            if (file != null && file.ContentLength > 0)
                            string fname = Path.GetFileName(file.FileName);
                            file.SaveAs(Path.Combine(FolderPath, fname));

Usage Information

NOTE: The error and success callbacks are handled asynchronously, so code that is placed directly after the "upload" function call will be executed immediately while waiting for the user's response input.


This extension reads the transport configuration in your config.xml (only if it exists).

If it does not, the following transport order is assumed:

  • WIFI
  • BIS-B
  • MDS
  • WAP2
  • WAP

For more information, visit: http://supportforums.blackberry.com/rim/attachments/rim/java_dev@tkb/397/1/Network_Tranports_tutorial.pdf


url: URL to upload file to

file: File to upload to remote server

fileKey: Field name of the uploaded file

mimeType: Uploaded file mimeType (if not specified, default is JPG)

params: Extra parameters to send along with your file

headers: Set HTTP request headers

success: Success callback. This method is called when the POST has completed successfully.

error: Error callback. This method is called when there is an error (invalid file paths, file not found, etc)

timeout: The amount of milliseconds this extension will attempt a connection.

Change Log


  • Closes gh-1


  • Extension now reads rim:connection tag from config.xml
  • Timeout option added (defaults to 30000 milliseconds)