Html5开发 之 文件上传

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/z_x_Qiang/article/details/88954107

Html:

<div>
            <form enctype="multipart/form-data" action="upload/" method="POST" target="hidden_frame_apk">
                <input type="file" name="file"/>
                <input id="input_gameId_apk" type="hidden" name="gameId" value=""/>
                <input type="hidden" name="type" value="apk"/>
                <input id="updata_btn_apk" class=" btn" type="submit" value="上传文件"/>
            </form>
            <iframe name='hidden_frame_apk' id="hidden_frame_apk" style='display: none'></iframe>
        </div>

JavaScript:

let updata_btn_apk = document.getElementById("updata_btn_apk");
updata_btn_apk.onclick=function (){
    let hidden_frame = document.getElementById("hidden_frame_apk");
    hidden_frame.onload = function () {
        //上传结果处理;
        let body = hidden_frame.contentDocument.body.innerText;
        getParentPackage(gameId);
        alert(body);
    };
};

猜你喜欢

转载自blog.csdn.net/z_x_Qiang/article/details/88954107
今日推荐