Como excluir o arquivo da pasta usando o javascript?

Existe alguma maneira de excluir arquivos da pasta usando javascript ..? Aqui é a minha função

function deleteImage(file_name)
    {
        var r = confirm("Are you sure you want to delete this Image?")
        if(r == true)
        {
            var file_path = <?php echo dirname(__FILE__) . '/uploads/'?>+file_name;
            file_path.remove();
        }
    }

questionAnswers(6)

yourAnswerToTheQuestion