前端 upload(file) { const formData = new FormData(); formData.append('type', 'file'); formData.append('media', file); const reopt = { method: 'POST', url: '/api/v1/yzl/uploadMedia', withCredentials: false, validateStatus: status => status >= 200, maxRedirects: 0, responseType: 'text', data: formData, // chunk_size: 4 * 1024 * 1024, multipart: true, timeout: 60 * 5 * 1000 };
后端获取文件 const { media } = ctx.request.files;