使用Fetch API HTTP PUT将与{<img/>`标记的src属性关联的文件

时间:2019-01-25 18:23:16

标签: javascript html reactjs http fetch

假设我们有一个<img src='http://example.net/image.png' />已被加载并由浏览器显示。我们如何将PNG文件放置到http://example.net/image2.png中,最好不要先重新获取它?

我的尝试

fetch('http://www.example.net', {
    method: 'PUT',
    headers: {
      'Content-Type': 'image/png'
    },
    body: // What to put here?
}

0 个答案:

没有答案
相关问题