fe-learn-code icon indicating copy to clipboard operation
fe-learn-code copied to clipboard

demo4:bug:

Open wangdabaoqq opened this issue 6 years ago • 0 comments

<h1>多文件上传  之 xhr formdata</h1>
    <div>
        选择文件(可多选):
        <input type="file" id="f1" multiple/><br/><br/>
        <button type="button" id="btn-submit">上 传</button>
    </div>
  var fileList = document.getElementById('f1').files;
        console.log(document.getElementById('title'))
        if(!fileList.length){
            alert('请选择文件');
            return;
        }
        var fd = new FormData();   //构造FormData对象
        fd.append('title', document.getElementById('title').value); 

关于 document.getElementById('title') 不存在直接获取是不是有点问题?

wangdabaoqq avatar Dec 02 '19 10:12 wangdabaoqq