Take the 2-minute tour ×

This should be a simple solution, but it's driving me crazy.

I am using the FileTransfer plugin to upload a photo taken with the camera to the server, pretty much exactly like the docs. I am using basic HTTP authentication, which works perfectly on Android and iOS, but on blackberry, it's returning a 401 - Unauthorized error. Do you have to do something special to get the file upload working on the BB?

I have the whitelist set to *, so that shouldn't be the issue, plus it's working on all the other devices...

module.uploadPhoto = function(imageURI, obj) {
    $.mobile.loading( 'show', {
        text:'Sending File...', 

    var uploadURL = CONTEXT+'api/'+obj.id+"/files";

    var options = new FileUploadOptions();
    options.fileName = 'image_' + imageURI.substr(imageURI.lastIndexOf('/')+1);
    options.chunkedMode = false;

    var params = new Object();
    params.thread = 'object-' + obj.id;
    options.params = params;

    options.headers = {
        Authorization: 'Basic ' + loginCreds

    var ft = new FileTransfer();

    ft.upload(imageURI, uploadURL, 
            custAlert('Finished upload!', 'Photo upload successful.');
            $.mobile.loading( 'hide' );  
            custAlert('Error uploading image with object: ' +error.http_status+ ' and code - ' +error.code, 'Error Uploading'); 
            $.mobile.loading( 'hide' );  
        options, true);


Does anyone know what's going on here? I am going a bit crazy... Thanks.

share|improve this question
I find that I have to specify the full url in the whitelist. The wildcard operator never worked for me. –  Tim Kim Jan 22 '13 at 20:08
Hmmm that's an interesting thought. Let me try that and get back to you. Thanks for the feedback. –  gabaum10 Jan 23 '13 at 15:17
By "Full URL" do you mean like myurl.com/api/v1/something ? You whitelist each API call? –  gabaum10 Jan 25 '13 at 19:12
Not every api call - just the main domain and set subdomains to be true. So I'd put <access subdomains="true" uri="myurl.com"; /> –  Tim Kim Jan 31 '13 at 21:42

Your Answer



Browse other questions tagged or ask your own question.