src/run_net_bin.js
function upload(file_mngr_url, file, filename, success, error) {
    // Assemble data
    var fd = new FormData();
    fd.append("filename", filename);
    fd.append("file", file);
    var req = new XMLHttpRequest();
    req.open("POST", file_mngr_url + "/upload");
    req.onload = function(e) {
        var url = JSON.parse(req.response).url;
        if (url === undefined)
            error();
        else
            success(url);
    };
    req.send(fd);
}
function upload(file_mngr_url, file, filename, success, error) {
    // Assemble data
    var fd = new FormData();
    fd.append("filename", filename);
    fd.append("file", file);
    var req = new XMLHttpRequest();
    req.open("POST", file_mngr_url + "/upload");
    req.onload = function(e) {
        var url = JSON.parse(req.response).url;
        if (url === undefined)
            error();
        else
            success(url);
    };
    req.send(fd);
}
function upload ( file_mngr_url , file , filename , success , error ) { // Assemble data var fd = new FormData ( ) ; fd . append ( "filename" , filename ) ; fd . append ( "file" , file ) ; var req = new XMLHttpRequest ( ) ; req . open ( "POST" , file_mngr_url + "/upload" ) ; req . onload = function ( e ) { var url = JSON . parse ( req . response ) . url ; if ( url === undefined ) error ( ) ; else success ( url ) ; } ; req . send ( fd ) ; }
Helper function This function uploads a file with a certain file name. If the upload is successful the first callback is executed, otherwise the second one is.
Helper function This function uploads a file with a certain file name . If the upload is successful the first callback is executed otherwise the second one is .