目录

工欲善其事

实践出真知

活跃标签: linux java mysql 待分类 js springboot win10 电路 vue macOS nginx esp32 git docker windows idea maven esp8266 python Arduino

存档:

js 将文本以文件的形式上传到服务器

  
            let file;
            const properties = {type: 'text/plain'}, data = this.code;
            try {
                file = new File([data], "file.txt", properties);
            } catch (e) {
                file = new Blob(data, properties);
            }
            const formData = new FormData()
            formData.append('file', file, key)
            postAction(this.url.uploadUrl, formData).then(res => {
                if (res.success) {
                
                }
            });

标题:js 将文本以文件的形式上传到服务器
作者:llilei
地址:http://solo.llilei.work/articles/2021/09/25/1632571087693.html