Is do_rename a synchronous function or asynchronous?  It it is asynchronous
then you will need to have  do_rename  call a callback function when it is
finished.  Then I would code it like this ...

exports.files_post = function(req, res) {

    if (req.files.file1.size > 0) {
          do_rename(ref.files.file1, rename2);
    } else rename2();

   function rename2() {
        if (req.files.file2.size > 0) {
               do_rename(ref.files.file2, done )
        } else done();
    }

    function done() {
         res.render('end');
    }
}

There are many other ways to code it.  I suspect there will be a hundred
messages now telling you how to code it and what ways there are to make
your original code work with add-on tools.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to