Autojs – 文件上传

//如果遇到SocketTimeout的异常,重新多运行几次脚本即可

console.show();
example1();
example2();
example3();
example4();
example5();

function example1() {
    var res = http.postMultipart("http://posttestserver.com/post.php", {
        "file": open("/sdcard/1.txt")
    });
    log("例子1:");
    log(res.body.string());
}

function example2() {
    var res = http.postMultipart("http://posttestserver.com/post.php", {
        "file": ["1.txt", "/sdcard/1.txt"]
    });
    log("例子2:");
    log(res.body.string());
}

function example3() {
    var res = http.postMultipart("http://posttestserver.com/post.php", {
        "file": ["1.txt", "text/plain", "/sdcard/1.txt"]
    });
    log("例子3:");
    log(res.body.string());
}

function example4() {
    var res = http.postMultipart("http://posttestserver.com/post.php", {
        "file": open("/sdcard/1.txt"),
        "aKey": "aValue"
    });
    log("例子4:");
    log(res.body.string());
}
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 共3条

请登录后发表评论