problem reading and writing files in subdirectories from javascript

Denis's icon

Hello

I would like to read and write text files from javascript. I would like the text files to be located in a subdirectory, but even if I specify a proper file path, the text file writes in the same directory as the javascript file.
Do I miss something?

my test function:
function test()
{
    var f = new File('/testdir/testfile.txt','write','TEXT');
    f.writestring('test');
    f.close();
}

// the file 'testfile.txt' appears in the same directory as the js file, not in the testdir subdirectory.

Thanks

Denis's icon