Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Cannot Upload the file using box module

$
0
0

Hi everyone .... i was trying to upload the file from local directory using box., but cannot upload it... i dont know what the reason is ... if someone can help me that would be great...

code :

function upload(){ Ti.API.debug('upload file:');

var data = [{'V':10},{'Pr':20},{'Ka':30},{'Ak':40},{'Kr':50},{'S':60}]; var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory , 'demo.csv'); if(!file.exists){ file.createFile(); } file.write(data);

BOXModule.callMethod("upload", {
            "file" : file.nativePath,
             parent_id: 'PDF',
            "share" : "0",
            "message" : "Uploaded using API",
            "name" : "XML",
            "folder_id" : 'XML'
                            //"folder_id" : app.globals.current_folder
        }, function(data) {
            if(data.success) {
                Ti.API.debug(data);
                dumpFolderContents(app.globals.current_folder);

            }
        });

};

function dumpFolderContents(_folder_id, backwards) { // get the table view var folderList = app.globals.mainWindow.folderList; var mainWindow = app.globals.mainWindow;

var find_by_folder_id = _folder_id || BOXModule.ROOT_FOLDER_ID;

if((find_by_folder_id != BOXModule.ROOT_FOLDER_ID ) && (!backwards)) {
    app.globals.history.push(app.globals.current_folder);
}

BOXModule.callMethod("get_account_tree", {
    "folder_id" : find_by_folder_id,
    "params[]" : ['nozip', 'onelevel']
}, function(data) {

    app.GlobalUpdate('current_folder', find_by_folder_id);
    var pDialog = U.createActivityWindow('Loading...');

    pDialog.show();

    Ti.API.debug('List folders callback');
    pDialog.setMessage("Loading Folders");
    var xmlDoc = U.xmlToJson(Ti.XML.parseString(data.responseText));
    var root_folder = xmlDoc.response ? xmlDoc['response']['tree']['folder'] : xmlDoc['tree']['folder'];

    mainWindow.updateWindow(root_folder, find_by_folder_id, pDialog);

});

};

the total code can be found in below link

  1. https://drive.google.com/folderview?id=0BxMPRWy8lf6zN1RvVzdNMWR2UjA&usp=sharing

  2. https://drive.google.com/?tab=mo&authuser=0#folders/0BxMPRWy8lf6zN1RvVzdNMWR2UjA


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>